Problem loading the plyr package

不想你离开。 提交于 2019-12-06 21:35:55

问题


I use R 2.13.1 and have unsuccessfully tried to load the package "plyr 1.6" in R. I have manually installed it into a directory "~/R/library". My code is:

.libPaths("~/R/library")
 library(plyr)

I get the message:

Error in library(plyr) : 'plyr' is not a valid installed package

It works fine with other packages ("chron", "zoo", "ismev", "Lmoments"), but not for the "plyr" package, and I have no idea what is goin on. I have tried installing and loading earlier versions of "plyr", but with the same result.

I appreciate any help a lot since I am stuck! Regards Sisse


回答1:


This isn't an answer to manually installing plyr. This is more answer about why you have to manually install in the first place.

I suspect your CRAN mirror is improperly set. To check, type

options("repos")[[1]][1]

This should return something like:

> options("repos")[[1]][1]
                                    CRAN 
"http://streaming.stat.iastate.edu/CRAN" 
> 

try setting your repo to a different mirror like this:

options(repos="http://streaming.stat.iastate.edu/CRAN")

or use any other mirror of your choice.

Then try loading plyr:

install.packages("plyr")
library("plyr") 

and let us know what happens.




回答2:


Might want to have a look at ?install.packages. It makes it very straightforward to install packages from CRAN. As simple as install.packages(pkgs="plyr").




回答3:


Unpacking the tar.gz file only works if the package contains only R code. plyr uses external code, which isn't compiled if you just extract the source to a library.

Use install.packages with repos = NULL to install from the source file.

install.packages("path/to/the/file/plyr_1.6.tar.gz", repos = NULL)

In the long term, the best solution is to fix your internet issues. If you're on a corporate network, speak to your network admin because they are likely blocking the traffic.



来源:https://stackoverflow.com/questions/7258639/problem-loading-the-plyr-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!