Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors installing plyr / rcpp

Tags:

r

rcpp

plyr

I have two computers and in one of them I can't manage to install the plyr package for R. This is the error I get:

* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG   -I"/usr/lib/R/site-library/Rcpp/include"   -fpic  -O2 -pipe -g  -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp: En la función ‘SEXPREC* plyr_loop_apply(SEXP, SEXP)’:
RcppExports.cpp:15:9: error: ‘input_parameter’ no es un miembro de ‘Rcpp::traits’
RcppExports.cpp:15:40: error: expected primary-expression before ‘int’
RcppExports.cpp:15:40: error: expected ‘;’ before ‘int’
RcppExports.cpp:16:9: error: ‘input_parameter’ no es un miembro de ‘Rcpp::traits’
RcppExports.cpp:16:49: error: expected primary-expression before ‘>’ token
RcppExports.cpp:16:50: error: ‘::type’ no se ha declarado
RcppExports.cpp:16:57: error: expected ‘;’ before ‘f’
RcppExports.cpp:17:36: error: ‘n’ no se declaró en este ámbito
RcppExports.cpp:17:39: error: ‘f’ no se declaró en este ámbito
RcppExports.cpp: En la función ‘SEXPREC* plyr_split_indices(SEXP, SEXP)’:
RcppExports.cpp:31:9: error: ‘input_parameter’ no es un miembro de ‘Rcpp::traits’
RcppExports.cpp:31:54: error: expected primary-expression before ‘>’ token
RcppExports.cpp:31:55: error: ‘::type’ no se ha declarado
RcppExports.cpp:31:62: error: expected ‘;’ before ‘group’
RcppExports.cpp:32:9: error: ‘input_parameter’ no es un miembro de ‘Rcpp::traits’
RcppExports.cpp:32:40: error: expected primary-expression before ‘int’
RcppExports.cpp:32:40: error: expected ‘;’ before ‘int’
RcppExports.cpp:33:65: error: ‘group’ no se declaró en este ámbito
RcppExports.cpp:33:72: error: ‘n’ no se declaró en este ámbito
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/rgalhama/R/x86_64-pc-linux-gnu-library/2.15/plyr’
Warning in install.packages :
  installation of package ‘plyr’ had non-zero exit status

It looks like the package can't be compiled, but I can't figure out why. Before the installation starts, I get this warning message:

Warning in install.packages : dependency ‘Rcpp’ is not available

I have installed rcpp from the system (as sudo apt-get install r-cran-rcpp), since I don't find a way to install it from R:

install.packages("Rcpp", repos='http://cran.us.r-project.org') Installing package(s) into ‘/home/rgalhama/R/x86_64-pc-linux-gnu-library/2.15’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘Rcpp’ is not available (for R version 2.15.2)

But still I don't know if these errors are related.

Any ideas?

Thanks!

like image 953
rgalhama Avatar asked Jun 07 '14 10:06

rgalhama


1 Answers

Got it!

The solution in my case was:

First, update R:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo sh -c "echo 'deb http://streaming.stat.iastate.edu/CRAN/bin/linux/ubuntu quantal/' >>  /etc/apt/sources.list" 
sudo apt-get update 
sudo apt-get install r-base r-base-dev

Then install codetools package from R:

install.packages("codetools")

After this, the installation of plyr went smoothly.

like image 183
rgalhama Avatar answered Oct 29 '22 01:10

rgalhama