[R] path and R CMD check

Christophe Genolini cgenolin at u-paris10.fr
Fri Jul 25 14:34:39 CEST 2008




Uwe Ligges-3 wrote:
> 
> 
> 
> Christophe Genolini wrote:
>> Hi the list,
>> 
>> When I developpe my code, I put the file that define all the functions 
>> in ./MyPack/R/prog.R and the tests in ./MyPack/tests/testsProg.R
>> The test files start by
>> 
>> load("../data/myData.rda")
>> source("../R/prog.R")
>> #test function number one...
>> 
>> But "R CMD check MyPack" does not find the file myData.rda.
>> Does someone knows what is wrong ?
> 
> 
> Read Writing R Extensions, learn how a package works (and yes, it works 
> without sourcing files separately since the package mechanism does the 
> job for you) and just say:
> 
> library("packagename")
> data("myData")
> 
> Best wishes,
> Uwe Ligges
> 
> 
I try but I find it very hard. Do you have more precision about the part
that explain it ? I read it several time, but I did not find that much on
tests.

So I do it on my own way. But I would love to know more about the way used
by real programmer. 

So far :
 - I am writing my code in several files /myPack/R/progA.R and
/myPack/R/progB.R
 - I am writing tests in /myPack/tests/testsProgA.R and
/myPack/tests/testsProgB.R
 - I am writing a main program in /myPack/main.R. This main program is
calling the tests.
 - Since the progB.R is an extension of progA.R, the testsB.R use some data
define in testsA.R

Before today, I was starting by
> load("../data/myData.rda")
> source("../R/prog.R")

But you tell me to do :
> library("myPack")
> data("myData")

Using this system is problematic during the development phase, since the
package is not ready and library(myPack) will not work

Any advice for a better way of working ?

Christophe
-- 
View this message in context: http://www.nabble.com/path-and-R-CMD-check-tp18622300p18650854.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list