简体   繁体   中英

R package installation

I have basically two questions.

  1. How do I locate the default Rprofile which is running? I have not setup a Rprofile yet, so I am not sure where it is running from.

  2. I am trying to install a few packages using the command (after doing a SUDO in the main terminal).

install.packages("RODBC","/home/rama/R/i486-pc-linux-gnu-library/2.9")

and I get back an error which says:

ERROR: failed to lock directory '/home/rama/R/i486-pc-linux-gnu-library/2.9' for modifying Try removing '/home/rama/R/i486-pc-linux-gnu-library/2.9/00LOCK'

The downloaded packages are in '/tmp/RtmpkzDMVU/downloaded_packages' Warning message: In install.packages("RODBC", "/home/rama/R/i486-pc-linux-gnu-library/2.9") : installation of package 'RODBC' had non-zero exit status

A few comments to your questions:

  1. Look at help(Startup) . You are probably running $R_HOME/etc/Rprofile [ which on Ubuntu and Debian is also available as /etc/R/Rprofile as we created softlinks to connect them ] and you have both an empty $R_HOME/etc/Rprofile.site as well as ~/.Rprofile to play with.
  2. For starters, do ls -l on the lockfile and see it is there. If so, and if you have no other R process running, remove. Re-start the package install.
  3. RODBC needs development headers for an ODBC library and all that -- again, for Debian / Ubuntu you just say sudo apt-get install r-cran-rodbc . If you run another distro, see if they have RODBC prepackaged.
  4. Regarding ~/.Rprofile there are few possible tips and tricks you can learn from this earlier StackOverflow question .

Concerning your package installation, I think the problem is "/home/rama/R/i486-pc-linux-gnu-library/2.9/00LOCK". Just rm this dir and the installation will work.

a ref in Chinese: http://cos.name/cn/topic/108555#post-239310

Thanks for the reply. That really helps indeed!. I got my RODBC package installed using sudo apt-get. That was painless. However, I am still a bit confused regarding which Rprofile is being run. I am indeed running Ubuntu Jaunty.

When I do a whereis R command, I get the following.

R: /usr/bin/R /etc/R /usr/lib/R /usr/local/lib/R /usr/share/R /usr/share/man/man1/R.1.gz

Under /etc/RI have

ldpaths Makeconf Renviron Renviron.site repositories Rprofile.site

If I cd to /usr/lib/R/etc, I have

ldpaths Makeconf Renviron Renviron.site repositories Rprofile.site

1) My question is, which of these is being used to run R?

2) When I do a sudo apt-get install r-cran-rodbc, where is the package being installed?

3) I have a home folder for R at /home/rama/R/i486-pc-linux-gnu-library/2.9 where my bioconductor packages are all located. How do I get the sudo apt-get packages to install here? (? .Rprofile) Is it even necessary?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM