简体   繁体   English

使用R包或库安装.zip文件时出错

[英]Error installing .zip file with R package or library

I am trying to install the R package MixeR 2003 by Batagelj and Bren . 我正在尝试安装Batagelj和Bren的R软件包MixeR 2003。 This is not in CRAN, but is accessible on this website as a downloadable zip file containing an R file ( MixeR.R ), a dataset ( Glac.dat ) and 3 pdf's. 它不在CRAN中,但可以在此网站上以可下载的zip文件访问, 文件包含R文件( MixeR.R ),数据集( Glac.dat )和3个pdf。

I downloaded the zip file, and placed it in my R directory. 我下载了zip文件,并将其放在我的R目录中。 After that, I attempted to install it from within RStudio using the drop-down menus Tools > Install Packages > Package Archive File (.zip; .tar.gz) > MixeR.zip , getting the following error message: 之后,我尝试使用下拉菜单Tools > Install Packages > Package Archive File (.zip; .tar.gz) > MixeR.zip从RStudio中安装它,得到以下错误消息:

install.packages("~/R/MixeR.zip", repos = NULL, type = "win.binary") install.packages(“〜/ R / MixeR.zip”,存储库= NULL,类型=“ win.binary”)

Installing package into 'C:/Users/Documents/R/win-library/3.3' 将软件包安装到“ C:/Users/Documents/R/win-library/3.3”

(as 'lib' is unspecified) (因为未指定“ lib”)

Warning in install.packages : cannot open compressed file 'MixeR/DESCRIPTION', probable reason 'No such file or directory' install.packages中的警告:无法打开压缩文件“ MixeR / DESCRIPTION”,可能是“无此文件或目录”的原因

Error in install.packages : cannot open the connection install.packages中的错误:无法打开连接

What am I doing wrong, and how can I install this package? 我在做什么错,如何安装此软件包?

It may very well be that it is actually not a package, but rather a 'library', in which case I would appreciate guidance as to how to make the functions and datasets in it accessible to the R session. 很有可能它实际上不是一个包,而是一个“库”,在这种情况下,我希望您能得到有关如何使R会话可以访问其中的函数和数据集的指导。

If you download and extract you'll see that that it's some pdfs, a .dat file, and a single R script that contains a bunch of functions. 如果下载并解压缩,您会看到它是一些pdf,一个.dat文件以及一个包含一堆函数的R脚本。

Likely you just want to source the script so you want to extract the zip archive and then use source on MixeR.R 可能您只想来源脚本,所以您要提取zip存档,然后在MixeR.R上使用source

source("path/to/MixeRArchive/MixeR.R")

Alternatively they do host that file on their website directly so you could just read it from the internet directly 另外,他们确实将该文件直接托管在其网站上,因此您可以直接从互联网上读取该文件

source("http://vlado.fmf.uni-lj.si/pub/MixeR/MixeR.R")

Either way will read the functions directly into your global environment since it isn't an actual package with its own namespace. 两种方法都可以将函数直接读取到全局环境中,因为它不是具有其自身名称空间的实际包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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