我在R中写了一个非常基本的包.其实我跟着
this tutorial创建了一个基本的包.
我的包在linux上工作得很好.例如:
> install.packages("linmod",repos=NULL) Warning in install.packages("linmod",repos = NULL) : argument 'lib' is missing: using '/home/jpgoel/R/i486-pc-linux-gnu-library/2.9' * Installing *source* package ‘linmod’ ... ** R ** data ** preparing package for lazy loading ** help *** installing help indices >>> Building/Updating help pages for package 'linmod' Formats: text html latex example ** building package indices ... * DONE (linmod) > library(linmod) > data(mod1) > mod1 Call: linmod.default(x = x,y = y) Coefficients: Const Bwt -0.3566624 4.0340627
现在,我拿了我的“linmod”文件夹,将其复制到Windows XP,并尝试以下操作:
> install.packages("C:\\Documents\ and\ Settings\\foo\\Desktop\\linmod",repos=NULL) Error in gzfile(file,"r") : cannot open the connection In addition: Warning messages: 1: In unzip(zipname,exdir = dest) : error 1 in extracting from zip file 2: In gzfile(file,"r") : cannot open compressed file 'linmod/DESCRIPTION',probable reason 'No such file or directory' >
好的.所以我拿起那个文件夹并把它放到.zip文件中.然后我去了Packages – >从本地zip文件安装包…并选择我的包.
> utils:::menuInstallLocal() updating HTML package descriptions > library(linmod) Error in library(linmod) : 'linmod' is not a valid installed package
我被困了我的包没有任何本地代码(例如,没有扩展名用C编写)