我无法访问互联网。因此,我从其他系统下载了 sqldf 包,然后将其传输到该系统。
sqldf_0.4-10.tar 文件保存在“C:\Users\Riya\Documents\R”中,二进制文件也保存在同一文件夹中。我也想安装带有依赖项的包。当我使用“包”下拉菜单下的“从本地 zip 文件安装包”安装包时。它没有安装依赖项。我用谷歌搜索解决方案,发现:
tools::write_PACKAGES("C:/Users/Riya/Documents/R/")
之后,
install.packages("sqldf", repos="file://C:/Users/Riya/Documents/R/")
它给了我一个错误 -
source repository is unavailable to check versions
Error in read.dcf(file = tmpf) : cannot open the connection
In addition: Warning message:
In read.dcf(file = tmpf) :
cannot open compressed file '//C:/Users/Riya/Documents/R/bin/windows/contrib/3.1/PACKAGES', probable reason 'No such file or directory'>
这是一个窗口系统。
注意:
tools::write_PACKAGES()
创建 2 个文件。我还根据论坛中提到的解决方案删除了“PACKAGES.gz”文件。 最佳答案
从 R 控制台,您可以使用:
install.packages("C:/Users/Riya/Documents/R/sqldf_0.4-10.tar", repos=NULL, type="source")
您也可以从 OS 命令行安装,使用 R CMD INSTALL 作为 G. Grothendieck 在评论中写道。
关于来自本地驱动器的 R 包,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30018313/