简体   繁体   中英

R package installation in ubuntu

Something of a newbie here. I've been working in R for windows and have recently moved to ubuntu, ("Hardy Heron" I think). I'm also not a linux guy. Anyway. I'm tring to install the "diptest" package. I ran the command

install.packages("diptest") 

and the output is:

Installing package(s) into '/home/smart/R/i486-pc-linux-gnu-library/2.6' (as 'lib' is unspecified) which is a little strange since I'm running R 2.12.1. And then it hangs.

Also, if I call library("diptest") it says that I need to reinstall the package because it is built for R 2.6. Is the process for reinstalling different than install.packages ? Thanks. Sorry to ask such a simple question.

Reinstalling is exactly the same procedure as installing, namely install.packages("diptest"). You might want to use the option repos to point to the correct repository. It seems there is going something wrong. AFAIK R uses the correct repos for the version, but it can be there's something odd going on with your installation. Make sure you followed the instructions for installing R on debian here .

So for my repos that would make :

install.packages("diptest",
   repos="http://www.freestatistics.org/cran/bin/windows/contrib/2.12")

You can get some information by using the command packageStatus() . This should also give you the repository, eg :

> update(packageStatus())
Number of installed packages:

                         ok upgrade unavailable
  E:/R/Library          111       1           2
  C:/R/R-2.12.2/library  26       2           0

Number of available packages (each package counted only once):

                                                              installed not installed
  http://www.freestatistics.org/cran/bin/windows/contrib/2.12        99          2791
  http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12         3            12

If that is OK, you can check whether the package is actually installed :

"diptest" %in% installed.packages()

if yes, you can check with old.packages() whether you can find a newer version.

> old.packages()
         Package    LibPath                 Installed     Built    ReposVer     
survival "survival" "E:/R/Library"          "2.36-2"      "2.12.1" "2.36-5"     
lattice  "lattice"  "C:/R/R-2.12.2/library" "0.19-17"     "2.12.2" "0.19-23"    
Matrix   "Matrix"   "C:/R/R-2.12.2/library" "0.999375-46" "2.12.2" "0.999375-49"
         Repository                                                   
survival "http://www.freestatistics.org/cran/bin/windows/contrib/2.12"
lattice  "http://www.freestatistics.org/cran/bin/windows/contrib/2.12"
Matrix   "http://www.freestatistics.org/cran/bin/windows/contrib/2.12"

If that is true, you can either install a new version using

install.packages("diptest")

or just update all of them, using

update.packages()

HTH

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