Tuesday, April 1, 2014

Installing ggplot2 in Ubuntu 12.04 (64 bit)

This version of Ubuntu installs an Older version of R (2.x), thus making the installation of ggplot2 infeasible.  Because ggplot2 requires >3.x version of R.

To upgrade the installed R to a higher version do, the following:

  1. sudo gedit /etc/apt/sources.list
    This will open up your sources.list file in gedit, where you can add the following line.
  2. deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ version/
    Replace version/ with whatever version of Ubuntu you are using (eg, precise/oneric/, and so on). If you're getting a "Malformed line error", check to see if you have a space between /ubuntu/ and version/.
  3. Fetch the secure APT key with gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
  4. Feed it to apt-key with gpg -a --export E084DAB9 | sudo apt-key add -
  5. Update your sources and upgrade your installation with sudo apt-get update && sudo apt-get upgrade.

This will install a higher version of R.  So you can go inside R and perform a install.packages("ggplot2").

Hope it helps someone.

No comments:

Post a Comment