Articles

Install package strex in ubuntu

To update this package, I have been forced to remove it and to install it again. Otherwise, I get an error like this one: Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘stringr’ in dyn.load(file, DLLpath = DLLpath, ...) : impossible de charger l'objet partagé '/usr/lib/R/site-library/stringi/libs/stringi.so' :   libicuuc.so.70: cannot open shared object file: No such file or directory

update raster package

Ubuntu 24.01  You must first install terra package before install raster package.

Speed to extract vector element by name with or without returning name: ["x"], [["x"]], [n] or unname()

The speed is higher using [[n]] then [["x"]]. unname(["x"]) is the slowest.   > Growth        alpha         beta            M            S            K           x0   0.007984356  0.018129643 81.782205061  2.978223538 13.309442413  5.072000000  > system.time({for(i in 1:1E6) K <- Growth[[1]]})    user  system elapsed    0.035   0.000   0.035  > system.time({for(i in 1:1E6) K <- Growth[["alpha"]]})    user  system elapsed    0.083   0.002   0.086  > system.time({for(i in 1:1E6) K <- Growth[1]})    user  system elapsed    0.145   0.004   0.150  > system.time({for(i in 1:1E6) K <- Growth["alpha"]})    user  system elapsed    0.150   0.004   0.154  > system.time({for(i in 1:1E6) K <- unname(Growth[1])})    user  system elapsed    1.122   0.007   1.135  > system.time({for(i in 1:1E6) K <- unname(Growth["alpha"])})    user  system elapsed    1.144   0.011   1.158 

Error in gcc to compile packages in MacOSX

In MacOSX, if you have homebrew installed: To prevent an error during compilation of packages, modify these two files: sudo vi /Library/Frameworks/R.framework/Versions/Current/Resources/etc/Makeconf In "Makeconf" change the line beginning by: FLIBS =  by: FLIBS =  -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/14 -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current -lgfortran -lquadmath -lm and the one beginning by: FC = by FC = /opt/homebrew/bin/gfortran -arch arm64 Create a file  sudo vi ~/.R/Makevars with  FC = /opt/homebrew/Cellar/gcc/14.2.0/bin/gfortran F77 = /opt/homebrew/Cellar/gcc/14.2.0/bin/gfortran FLIBS = -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current The value 14.2.0 must be changed depending on the current version. I try this but it didn't work: FC = $(find /opt/homebrew/Cellar/gcc/* -maxdepth 0 -type d)"/bin/gfortran" F77 = $(find /opt/homebrew/Cellar/gcc/* -maxdepth 0 -type d)"/bin/gfortran" FLIBS = -L$(find

R asking to install additional tools

If R crashes and asks to install  additional tools to compile code, try: options(buildtools.check = function(action) TRUE)

Install imager package in Ubuntu with fftw

Install the last version of fftw to have full possibilities of imager package: Go directly at the end of that post to have the solution ! Check the last version of  fftw here http://www.fftw.org wget http://www.fftw.org/fftw-3.3.10.tar.gz tar -xf fftw-3.3.10.tar.gz cd fftw-3.3.10 ./configure make sudo make install cd .. rm fftw-3.3.10.tar.gz rm -r fftw-3.3.10 then in R install.packages("imager") It fails with imager 1.0.1 with the following error : g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o imager.so RcppExports.o colourspace.o coordinates.o display.o drawing.o filtering.o hough.o imgraphs.o interact.o interpolation.o morphology.o reductions.o transformations.o utils.o wrappers.o -fopenmp -lX11 -Dcimg_use_fftw3 -L/usr/local/lib -lfftw3 -ltiff -L/usr/lib/R/lib -lR /usr/bin/ld: /usr/local/lib/libfftw3.a(assert.o): warning: relocation against `stdout@@GLIBC_2.2.5' in read-only section `.text'

Comparison of models by AIC with or without log transformation on Y

You cannot compare the AIC or BIC when fitting to two different data sets i.e. 𝑌 and 𝑍. You only can compare two models based on AIC or BIC just when fitting to the same data set. Have a look at Model Selection and Multi-model Inference: A Practical Information-theoretic Approach (Burnham and Anderson, 2004). They mentioned my answer on page 81 (section 2.11.3 Transformations of the Response Variable): Investigators should be sure that all hypotheses are modeled using the same response variable (e.g., if the whole set of models were based on log(y), no problem would be created; it is the mixing of response variables that is incorrect). Akaike (1978, pg. 224) describes how the AIC can be adjusted in the presence of a transformed outcome variable to enable model comparison. He states: “the effect of transforming the variable is represented simply by the multiplication of the likelihood by the corresponding Jacobian to the AIC ... for the case of log{𝑦(𝑛)+1}, it is −2 ⋅∑log{𝑦(𝑛)+1},