Friday, October 16, 2015

Set up R on Mac OSX

Use the official pkg file from CRAN, don’t install R from brew.
Use system library folder, don’t set up a personal library folder.

Set up repo:

local({r <- getOption("repos")
       r["CRAN"] <- "http://cran.r-project.org" 
       options(repos=r)
})

You need curl with SSL support and libxml2:

brew install --with-libressl curl
brew install libxml2

Make sure that the system is using curl and libxml2 from brew:

cd /usr/bin
mv curl curl.mac 
brew link curl --force
cd /usr/
sudo mkdir include
cd include/
sudo ln -s /usr/local/opt/libxml2/include/* .

Then install the curl package from R:

install.packages(c("curl", "RCurl"), type="source")

You might the legacy Java 6 runtime from Apple in order to use rJava.

And other packages:

 install.packages(c("devtools", "dplyr", "Rcpp", "rJava", "ggplot2", "testthat", "roxygen2"))

To generate R package manuals, you need a TeX distribution. Install BasicTex and then add a few additional packages:

sudo tlmgr install epsf fancyvrb inconsolata listings mptopdf natbib url collection-fontsrecommended

0 comments: