Skip to content

A guide to R packages for Ubuntu

8 messages · Michael Rutter, Liviu Andronic, Dirk Eddelbuettel +1 more

#
As per a request, here is a brief guide to what is available to R users 
as packages in Ubuntu.

Each release of Ubuntu includes the latest version of R and the 
recommended packages.  In addition, there are approximately 80 
additional r-cran packages available in the default repositories.  The 
limitation to these packages is that they are not updated and reflect 
the current version of the program or package when that version of 
Ubuntu was released.

If you want to have current versions of R and the recommended packages, 
there are two repositories to choose from:

CRAN: http://cran.r-project.org/bin/linux/ubuntu/
Launchpad PPA: https://launchpad.net/~marutter/+archive/rrutter

Both sites have the same packages (the PPA packages are mirrored on 
CRAN), but there may be a reason to use one over the other.

CRAN Advantages:
- A local mirror may be faster in terms of internet speed.
- Older versions of the packages are available, so if an update to R or 
a core package breaks your code, you can reinstall an older version via 
synaptic or apt.

PPA Advantages:
- Quickest way to get the updates (only by about 24 hours however)
- Easy to install (sudo add-apt-repository ppa:marutter/rrutter)

If you have been using CRAN, then there is no reason to change to the 
PPA, as the same packages is provided at both locations.  I will 
continue to maintain both sites, so no need to worry about one or the 
other going away.

If you want additional packages (over 1,100), you can check out my 
cran2deb4ubuntu PPA:

https://launchpad.net/~marutter/+archive/c2d4u

In theory, this PPA has all the packages listed in the CRAN Task Views 
and any dependencies.  In practice, is has about 98% of them, as some 
packages have issues.  These packages can be installed via synaptic or 
apt (sudo apt-get install r-cran-ggplot2, for example).  The main 
advantage of this approach is that tricky Ubuntu package requirements 
will automatically be installed when installing the package.  They will 
also be automatically updated during normal Ubuntu updates, which is 
another advantage.  These packages are NOT installed when a 
install.packages("foo") command is used from within R.

One of my plans this summer/sabbatical is create documentation for the 
cran2deb4ubuntu project and give more information about what is and what 
is not available.

If you have any further questions, please let me know.
Michael
1 day later
#
On Fri, Apr 27, 2012 at 8:11 PM, Michael Rutter <mar36 at psu.edu> wrote:
Very interesting! Thanks for sharing this with us. It looks like
'cran2deb' did evolve to a useful state.
Is there a reason to limit 'cran2deb4ubuntu' to Task Views packages?
For example, I would like to install all the Rcmdr plug-ins via the
PPA but the only one available is 'rcmdrplugin.doe'. Very useful GUIs
such as 'playwith' and 'latticist' are missing, too. Even some popular
toolkit deps are missing: 'gwidgetstcltk'. Are there plans to increase
the number of packages provided?

Regards
Liviu
#
On 04/27/2012 02:11 PM, Michael Rutter wrote:
Michael,

Thanks so much for this information. I have a question about 
cran2deb4ubuntu PPA. Currently I use a CRAN repository, then 
install.packages() within R for whatever isn't available in the 
repository. If I want to use cran2deb4ubuntu, does it completely replace 
the CRAN repository? Or do I use both and let the package manager 
determine where to retrieve a package from?

Also, since I have many packages installed within R, do you know what 
the effect would be of adding the PPA? Would installed packages get 
updated, or would I have to uninstall in R and reinstall via PPA?

Thanks again for your work on this.

--Lee
#
On 29 April 2012 at 13:48, Lee Hachadoorian wrote:
| Thanks so much for this information. I have a question about 
| cran2deb4ubuntu PPA. Currently I use a CRAN repository, then 
| install.packages() within R for whatever isn't available in the 
| repository. If I want to use cran2deb4ubuntu, does it completely replace 
| the CRAN repository? Or do I use both and let the package manager 
| determine where to retrieve a package from?

It is entirely independent, and R resolves what it loads via .libPath(). On
my system, with the default suggested by the Debian / Ubuntu package

  R> .libPaths()
  [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       
  [3] "/usr/lib/R/library"           
  R> 

the local R packages always win.
 
| Also, since I have many packages installed within R, do you know what 
| the effect would be of adding the PPA? Would installed packages get 
| updated, or would I have to uninstall in R and reinstall via PPA?

No need, but see above and understand what .libPaths does. It's all
documented and has been answered before, eg 

  http://stackoverflow.com/questions/2170043/r-apt-get-install-r-cran-foo-vs-install-packagesfoo

Dirk
#
On 04/29/2012 02:30 PM, Dirk Eddelbuettel wrote:
Thanks for the information.

--Lee
#
Liviu,

I had to draw a line somewhere.  Maintaining all the packages was out of 
the question, as the number is just too high.  Since there is no list at 
this time of the most popular packages, I choose the Task View lists as 
a good place to start.  If and when this number of packages becomes 
manageable, I may add more.

Michael
#
On Mon, Apr 30, 2012 at 2:04 AM, Michael Rutter <mar36 at psu.edu> wrote:
I see, thanks for letting me know. Although not as reliable as the
Task Views, could the Crantastic popularity contest [1] be used for
this purpose?

Regards
Liviu

[1] http://crantastic.org/popcon
#
On 04/30/2012 01:54 AM, Liviu Andronic wrote:
That is a possibility.  Once I get all the bugs worked out, it will be 
something to consider.

Michael