So, I ask my self: what happens? Then (obviously) I google and found this post but it seems that it doesn't solve the problem (or at least I couldn't figure out how from it). Then I found this other which says that it could be that the R version is too old. This is the reason for that I want the latest version of R in my computer. I want to install the Rcpp package with syntactic sugar. But now, there is another problem. I can install R from the synaptic manager of ubuntu but I don't get the latest one (I get the 2.9.2 as I state above), in fact I can install the Rcpp package from there. But the package version also is too old as I can see via:
> install.packages("Rcpp") Warning in install.packages("Rcpp") : argument 'lib' is missing: using '/home/juan/R/x86_64-pc-linux-gnu-library/2.9' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Rcpp’ is not available
In fact, as is told here, syntactic sugar is included in the Rcpp package from the version 0.8.3 So, the solution seems to install the latest version of R. But: 1) From where? 2) How?. 3) I'll need to uninstall my actual version of R? I'm a bit (ok, more than a bit) scared to experiment with it (now) because I'm ending my PhD. Thesis. I don't want my system down now !!! Anyway, lets try... So, I try what it says about ubuntu in CRAN, that is I look in http://cran.r-project.org/bin/linux/ubuntu/ and via (the ubuntu menu) System -> Administration -> Software Sources -> Other Software tab add in the /etc/apt/sources.list file, a line like this:
> z<-installed.packages() > z["Rcpp","Version"]  "0.6.5".
In fact, this line is a kind of prototype, in the "real" one must replace <my.favorite.cran.mirror> by your prefered CRAN mirror (you can get a list of them here http://cran.r-project.org/mirrors.html). In my case this line becames:
deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu karmic
(note that this line depends on the ubuntu version, look in http://cran.r-project.org/bin/linux/ubuntu/ for how to be done in the other versions). Then ubuntu ask me to update, so I do that but I get this error:
So I simply do what is said here, that is, in a ubuntu terminal I run the commands:
W: GPG error: http://cran-r.c3sl.ufpr.br karmic/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D67FC6EAE2A11821
Then ubuntu ask me to update again and it works. So I continue with what is said in http://cran.r-project.org/bin/linux/ubuntu/, that is I run in a ubuntu terminal the commands:
gpg --keyserver keyserver.ubuntu.com --recv D67FC6EAE2A11821 gpg --export --armor D67FC6EAE2A11821 | sudo apt-key add -
Now I have the 2.12.1 R Version as I can view executing R in a ubuntu terminal. Now it is time to see if I can install the latest version of Rcpp. So the first thing is to see if it is already installed. So I get:
sudo apt-get update sudo apt-get install r-base sudo apt-get install r-base-dev
Now, it happens that when I tried (before upgrade R) to update all packages via:
> library("Rcpp") Error: package 'Rcpp' was built before R 2.10.0: please re-install it
it get stuck in some "place" trying to update the network package. Lets see what happens now... Ok, after a while I get:
So it seems to work partially, and in fact it fails with "Rcpp", the one that I mainly want to install !!! So, now I will try:
Warning messages: 1: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, : installation of package 'Rcpp' had non-zero exit status 2: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, : installation of package 'foreach' had non-zero exit status 3: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, : installation of package 'doMC' had non-zero exit status
It seems that it work because I get:
Lets see if I can install the other 2 packages that give me an error before. So I first try:
> library("Rcpp") > z <- installed.packages() > z["Rcpp","Version"]  "0.9.0"
and I get:
With the other package I get this:
> library("foreach") Loading required package: iterators Loading required package: codetools foreach: simple, scalable parallel programming from REvolution Computing Use REvolution R for scalability, fault tolerance and more. http://www.revolution-computing.com > z <- installed.packages() > z["foreach","Version"]  "1.3.0"
So, something goes wrong. It seems that the problem is that the multicore package is outdated, so I reinstall it:
> install.packages("doMC") Installing package(s) into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'http://cran-r.c3sl.ufpr.br/src/contrib/doMC_1.2.1.tar.gz' Content type 'application/x-gzip' length 93727 bytes (91 Kb) opened URL ================================================== downloaded 91 Kb * installing *source* package ‘doMC’ ... ** R ** demo ** inst ** preparing package for lazy loading Loading required package: iterators Loading required package: codetools Error : package 'multicore' was built before R 2.10.0: please re-install it ERROR: lazy loading failed for package ‘doMC’ * removing ‘/usr/local/lib/R/site-library/doMC’ The downloaded packages are in ‘/tmp/RtmpXRkkYx/downloaded_packages’ Warning message: In install.packages("doMC") : installation of package 'doMC' had non-zero exit status
So it seems it works. Now lets try with the igraph package:
> install.packages("multicore") ... BLA BLA BLA ... > library("multicore") > z <- installed.packages() > z["multicore","Version"]  "0.1-3" > > install.packages("doMC") ... BLA BLA BLA ... > library("doMC") > z <- installed.packages() > z["doMC","Version"]  "1.2.1"
So it seems to work. Lets try the last one, the network package:
> library("igraph") Error in library("igraph") : there is no package called 'igraph' > install.packages("igraph") ... A LOT OF BLA BLA ... > library("igraph") > z <- installed.packages() > z["igraph","Version"]  "0.5.5-1"
So it also seems to work. Now it remains to make some test to see if the installed packages works. Principally Rcpp and igraph. So, igraph works nicely with:
> library("network") Error in library("network") : there is no package called 'network' > install.packages("network") ... BLA BLA ... > library("network") Classes for Relational Data Version 1.6 created on January 28, 2011. copyright (c) 2005, Carter T. Butts, University of California-Irvine Mark S. Handcock, University of Washington David R. Hunter, Penn State University Martina Morris, University of Washington For citation information, type citation("network"). Type help("network-package") to get started. Attaching package: 'network' The following object(s) are masked from 'package:igraph': add.edges, add.vertices, %c%, delete.edges, delete.vertices, get.edge.attribute, get.edges, get.vertex.attribute, is.bipartite, is.directed, list.edge.attributes, list.vertex.attributes, %s%, set.edge.attribute, set.vertex.attribute > z <- installed.packages() > z["network","Version"]  "1.6"
it gives: here):
> g <- barabasi.game(100) > jpeg("test.jpg") > plot(g, layout=layout.fruchterman.reingold, vertex.size=4, vertex.label.dist=0.5, vertex.color="red", edge.arrow.size=0.5) > dev.off()
So, it was a success !!! Salut
> require(inline) Loading required package: inline > testfun = cxxfunction( + signature(x="numeric",i="integer"), + body = 'NumericVector xx(x); + int ii = as<int>(i); + xx = xx * ii; + return( xx ); + ', + plugin="Rcpp") > testfun(1:5,3)  3 6 9 12 15