Build R
1. Install R
Choose a mirror site
geographically close to you, and download either the
appropriate binary for your
platform (or the source code and then compile yourself). Set your path
appropriately. For example, my R executable is under
/Applications/R.app/Contents/MacOS on my Mac OS X, so I add
/Applications/R.app/Contents/MacOS as one of the search paths in my C
shell startup configuration file .cshrc
If the installation is successful, the following command on the prompt
R
will bring you into the R world! Quit R by typing q()
> q()
or hitting letter "d" while holding down CTRL key.
2. Download some prerequisite packages from R
Run the following inside R:
install.packages("snow",dependencies=TRUE)
install.packages("nlme",dependencies=TRUE)
install.packages("contrast",dependencies=TRUE)
install.packages("fastICA",dependencies=TRUE)
install.packages("afex",dependencies=TRUE)
install.packages("phia",dependencies=TRUE)
3. All AFNI programs in R are distributed with the AFNI package, and can be found in the abin directory.
4. Error regarding missing R_io.so
a) Make sure you have the most recent version of AFNI.
b) Make sure you have the most recent version of R.
c) Run the following command line and see if there are any missing libraries:
ldd `@GetAfniBin`/R_io.so
d) Copy and paste the following at the R prompt:
first.in.path <- function(file) {
ff <- paste(strsplit(Sys.getenv('PATH'),':')[[1]],'/', file, sep='')
ff<-ff[lapply(ff,file.exists)==TRUE];
#cat('Using ', ff[1],'\n');
return(gsub('//','/',ff[1], fixed=TRUE))
}
source(first.in.path('AFNIio.R'))
(ll <- find.in.path('R_io.so'))
dyn.load(ll)
Report to us: (1) the missing libraries revealed from c) above; (2) the output of the last two lines from d) above; (3) your computer OS version (and 32- or 64-bit?); (4) the second line from the output of the following command line at the terminal: afni -ver; (5) the first three lines from the output of the command line at the terminal: R --version
5. Fix for "segfault error" on Mac when running any R-related program
For those who encounter the following error on Mac OS when running R-related programs (3dMVM, 3dLME, 3dMEMA, ...)
> *** caught segfault ***
> address ..., cause 'memory not mapped'
> ...
here is the solution:
1) Remove everything under /Library/Frameworks/R.framework/
2) Delete R.app under /Applications/
3) Reinstall R (for Mac OS 10.9.x right now, consider installing the development version at http://r.research.att.com/mavericks/R-devel/R-devel-mavericks.pkg)
Related topics
Last modified 2014-09-18 15:00