I am trying to install packages in R, but after downloading, loading the package library will not work -- upon running require("<package_name>")
or library("<package_name>")
I get the error:
Error in library("package_name") : there is no package called ‘package_name’
I am running R 3.0.2 on Ubuntu 14.04.1, which is installed in a vagrant virtual machine running inside of os x mavericks.
I have tried re-installing everything (R, Ubuntu, sudo apt-get --reinstall install r-base-dev
). I have tried running R as root, all to no avail.
I've found two other accounts of this problem:
Ubuntu 12.04 R install.packages() does not work. No warning, no install
install.packages() Rstudio server AWS ubuntu error
And have tried the suggested solutions, but none of them work for me.
A little more background on my install procedures; here is the sequence of commands I used to install R in ubuntu:
sudo apt-get update
echo "deb http://http://ftp.osuosl.org/pub/cran/bin/linux/ubuntu trusty/" >> ./sources.list.appendme
sudo cat /etc/apt/sources.list ./sources.list.appendme > ./sources.list.tmp
sudo mv ./sources.list.tmp /etc/apt/sources.list
rm ./sources.list.appendme
sudo apt-get install r-base
sudo apt-get install r-base-dev
sudo apt-get --reinstall install r-base-dev
This follows the instructions found here: http://cran.r-project.org/bin/linux/ubuntu/README for installation of R in Ubuntu.
Here are the install steps I used to make my virtual machine:
> vagrant box add july24
> https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box
> vagrant init july24 vagrant up
Here is a comparison of the output I get from running the package installation in my OS X R installation and my Ubunutu R installation. Interestingly, the downloaded package sizes are generally much smaller in the Ubunutu attempt (47KB and 26KB in OS X's R, vs 14KB and 0.9257KB in the Ubuntu R). Not sure if this is a difference between R versions (3.0.3/3.0.2 in OS X/Ubunutu), or because of different reqs for the different OSs..
Correct, error-free package installation in OS X:
install.packages("dataview",repos="http://cran.cs.wwu.edu")
also installing the dependency ‘xtermStyle’
trying URL 'http://cran.cs.wwu.edu/bin/macosx/contrib/3.0/xtermStyle_2.2-4.tgz' Content type 'application/x-gzip' length 49060 bytes (47 Kb) opened URL ================================================== downloaded 47 Kb
trying URL 'http://cran.cs.wwu.edu/bin/macosx/contrib/3.0/dataview_2.0-9.tgz' Content type 'application/x-gzip' length 27032 bytes (26 Kb) opened URL ================================================== downloaded 26 Kb
The downloaded binary packages are in /var/folders/sy/w_z0czvs2nqd2ys0vf_827zc0000gn/T//RtmpOlT9rM/downloaded_packages
library('dataview')
Loading required package: xtermStyle
installation with the error in Ubuntu:
install.packages("dataview",repos="http://cran.cs.wwu.edu")
Installing package into ‘/home/vagrant/R/i686-pc-linux-gnu-library/3.0’ (as ‘lib’ is unspecified) also installing the dependency ‘xtermStyle’
trying URL 'http://cran.cs.wwu.edu/src/contrib/xtermStyle_2.2-4.tar.gz' Content type 'application/x-gzip' length 15265 bytes (14 Kb) opened URL ================================================== downloaded 14 Kb
trying URL 'http://cran.cs.wwu.edu/src/contrib/dataview_2.0-9.tar.gz' Content type 'application/x-gzip' length 9257 bytes opened URL ================================================== downloaded 9257 bytes
The downloaded source packages are in ‘/tmp/RtmppaTkT7/downloaded_packages’
library('dataview')
Error in library("dataview") : there is no package called ‘dataview’
library('dataview',lib.loc='/home/vagrant/R/i686-pc-linux-gnu-library/3.0')
Error in library("dataview", lib.loc ="/home/vagrant/R/i686-pc-linux-gnu-library/3.0") :
there is no package called ‘dataview’
Maybe there is something I am missing? Your help or suggestions are greatly appreciated.