9
votes

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!

4

4 Answers

5
votes

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.

2
votes

It looks like you have an old version:

R version 2.15.2

You can always try to update R to the most recent version.

2
votes

I had a very similar problem. Installing the Debian/Ubuntu build-essential package solved the problem for me:

sudo apt-get install build-essential

As it turns out, it's hard for R to compile things if a compiler isn't installed.

2
votes

After having a similar issue myself when trying to install plyr in RStudio on Ubuntu I found the following solution:

sudo apt-get install r-cran-plyr

Just dropping it here to help prevent people from going down quite a rabbit hole, like I did, before finding a working solution.