我最近已将R和Rstudio下载到我的计算机上。

当我尝试安装软件包ncdf(或任何软件包)时,收到以下消息:

> install.packages("ncdf")
Installing package into ‘C:/Users/Talos/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/ncdf_1.6.7.zip'
Content type 'application/zip' length 358300 bytes (349 Kb)
opened URL
downloaded 349 Kb

package ‘ncdf’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Talos\AppData\Local\Temp\RtmpKuMfwR\downloaded_packages

> load("ncdf")
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'ncdf', probable reason 'No such file or directory'

我尝试过转到文件夹并手动解压缩文件,这似乎没有任何区别。

有什么解决方案,以便我可以安装,加载和使用软件包?

最佳答案

您要library而不是load。请阅读帮助文件? library? load以获取更多信息。

关于r - 无法安装和加载软件包,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24973345/

10-10 05:55