[R] Changing downloaded source code into a package

Gabor Grothendieck ggrothendieck at gmail.com
Mon Aug 9 22:10:29 CEST 2010


On Mon, Aug 9, 2010 at 1:29 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Mon, Aug 9, 2010 at 10:22 AM, JH <dealing_with_doors at hotmail.com> wrote:
>>
>> I am wanting to change some lines of code in the R package named "nlme"
>> http://cran.r-project.org/web/packages/nlme/index.html
>> To do this I have downloaded the Package source named nlme_3.1-96.tar.gz,
>> opened up the file and changed the text documents within the folder named R,
>> specifically the cor.Struct.txt file.
>> I now want to know how can I use this modified nlme_3.1-96.tar.gz file in R
>> 2.10. How do I convert this source code into a package?
>>
>>
>> I have looked on the internet and tried using cmd.exe  then the code
>> Rmcd.exe INSTALL -1 ~/nlme_3.1-96.tar.gz
>> I end up getting the message "The system can't find the specified path",
>> when I have the file in the directory that Rmcd.exe is in.
>
> Assuming you have installed Rtools and have the R bin directory and
> the Rtools bin directory on your path
>
> cd to.wherever.your.tar.gz.file.is.located
> Rcmd INSTALL nlme_3.1-9.96.tar.gz
>
> Alternately, at http://batchfiles.googlecode.com is a file Rcmd.bat
> that you can call which will find Rtools and R in the registry and
> then run Rcmd.exe so you don't have to add anything to your path.  In
> that case you just place Rcmd.bat somewhere on your existing path and
> don't have to change your path at all.
>

Also one other thing you can do is to just insert a function into the
package at runtime using assignInNamespace

library(nlme)
myfunction <- ...
assignInNamespace("myfunction", myfunction, "nlme")

In that case you don't have to rebuild the package at all.



More information about the R-help mailing list