How to update and recompile nlme source code in R

狂风中的少年 提交于 2019-12-12 20:43:16

问题


I am attempting to update the ‘nlme’ package so that I can use great circular distances for the correlation in the gls command. I'm attempting to edit the source code with the changes specified here.

I am unsure about how to proceed in re-compiling the package with the updated source code. I am able to edit the source within the .tar.gz, but when I try to install the package from my local folder, I receive:

Installing package into ‘C:/Users/HSRG1/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
* installing *source* package 'nlme' ...
files 'R/corStruct.R', 'R/gls.R', 'R/lme.R' have the wrong MD5 checksums
** libs

*** arch - i386
ERROR: compilation failed for package 'nlme'
* removing 'C:/Users/HSRG1/Documents/R/win-library/3.0/nlme'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-30~1.0/bin/x64/R" CMD INSTALL -l  "C:\Users\HSRG1\Documents\R\win-library\3.0" "nlme_3.1-111.tar.gz"' had status 1 
2: In install.packages("nlme_3.1-111.tar.gz", repos = NULL, type = "source") :
installation of package ‘nlme_3.1-111.tar.gz’ had non-zero exit status

The functions R/corStruct.R', 'R/gls.R', 'R/lme.R are those which I am trying to edit. I do not know what this error means, particularly the bit about having incorrect checksums (I suspect the other errors follow). I found the following link: http://r.789695.n4.nabble.com/R-3-0-0-wrong-MD5-checksums-for-Windows-td4663348.html which discusses a different linebreak command which is implemented when compiling from Windows, but I do not know how this is relevant (or soluble) as the source has no linebreak declarations.. There is clearly something I'm missing.

I am using a Windows 64 bit computer - please let me know if there is any other information I need to provide.

UPDATE: As suggested I have tried to implement the corRGaus correlation in the ramps package. When I try to use the corRGaus correlation I get the following error:

y = runif(50, 1, 40)
x = runif(50, 1,20)
LC= c(rep(1,25), rep(2,25))
lat = runif(50,-90,90)
long = runif(50,180,180)
fit <- lme(y ~ x,random = ~x|LC, cor = corRGaus(form = ~lat+long))


Error in `coef<-.corSpatial`(`*tmp*`, value = value[parMap[, i]]) : 
NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning messages:
1: In nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars),  :
NA/NaN function evaluation
2: In nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars),  :
NA/NaN function evaluation
3: In nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars),  :
NA/NaN function evaluation
4: In nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars),  :

I am not sure what this error means, nor how to remedy it.

As a side note, after installing ramps, I am no longer able to use the corGaus correlation until restarting R (even if I detach the ramps package).

来源:https://stackoverflow.com/questions/18772919/how-to-update-and-recompile-nlme-source-code-in-r

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