[R] Changing downloaded source code into a package

Matt Shotwell shotwelm at musc.edu
Mon Aug 9 20:08:20 CEST 2010


See comments below.

On Mon, 2010-08-09 at 10:22 -0400, JH 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 couldn't find this file. Do you mean corStruct.R, or maybe
corStruct.c?

> 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?

The source code, along with the documentation, data files, etc. _is_ the
package. When the package contains source code from a compiled language
(C or Fortran), as nlme does, this code must be compiled for your
platform before the package is installed. The CRAN maintainers kindly
pre-compile this code for Windows and Mac OS X users. If you make
modifications to C or Fortran code in a package, you must re-compile the
code yourself, or use a service such as R-Forge.

The R manual `Writing R Extensions` is the standard reference for
packages. See also the `R Administration and Installation' manual. See
the information here

http://www.murdoch-sutherland.com/Rtools/

for compiling package code in Windows. Lastly, before you follow the
instructions at the URL above, I urge you to consider GNU Linux as a
platform for programming. I've found the tools available in standard GNU
Linux distributions (such as that available at http://www.debian.org)
much simpler to install and work with.

> 
> 
> 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.
> 
> 

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina



More information about the R-help mailing list