[R] How to upgrade library from R 1.9.1 to R 2.0.1

Gabor Grothendieck
Thu, 17 Feb 2005 04:26:32 -0000

YiYao_Jiang <YiYao_Jiang <at> smics.com> writes:

:
: Dear All:
:
: 	I have a library for R 1.9.1, it is very easy to setup a library in R
1.9.1.
:     For example:
:     I want to setup a library "test" for R1.9.1.
:     1. Create a folder "test" in the direct X:\ R\ rw1091\ library
\.
:     2. Create a file "DESCRIPTION" in the direct X:\ R\ rw1091\
library\
test\.
:     3. Modify the "Package:" and "Title:" item to
"test" in the
file "DESCRIPTION" .
:     4.Create a folder "R" in the direct X:\ R\ rw1091\ library\
test\ .
:     5.Create a file "test" in the direct X:\ R\ rw1091\ library\
test\ R\ .
:     6. Add all the function into the "test" file.
:     Then I can call the "test" using command " library (test)
".
:     I setup the library using the same way in R2.0.1, but the library
can't
work.
:     The error message is " Error in library(test) : 'test' is not
a valid
package -- installed < 2.0.0? "
:     I search the help file and document but still can't upgrade the
library.
:     Who can tell me how to upgrade library from R 1.9.1 to R 2.0.1 or give
me a sample, thanks.

I assume you are referring to a package that you wrote and want to
upgrade.

I think there may be confusion here between the source and installed
package.  The source package is what you wrote and it should _not_ go
into \R\rw2001\library\test.    Lets say we put that in \Rpkgs\test .
Then, assuming you just installed R 2.0.1, use the Rcmd.exe program
to install the source package into your R tree.

cd \Rpkgs
\R\rw2001\bin\Rcmd install test

to install it.  Fix up any errors you get during the install
and repeat until it installs. Now go into R and test it out.
If it seems to work try running 'Rcmd check' on it:

cd \Rpkgs
\R\rw2001\bin\Rcmd check test

and fix up any errors and repeat until it passes Rcmd check and
reinstall.

See the Writing Extensions Manual if the above is not sufficient.