tags:

views:

32

answers:

1

The command 'R CMD check' runs the R files in the project's tests directory.

The directory structure:

toplevel
  project
    R
      rmongo.R
    tests
      RMongo-Ex.R

When i R CMD check project in toplevel directory, i run into this error: cannot open file '../R/rmongo.R': No such file or directory

because my test file sources the R code file: source('../R/rmongo.R', chdir=TRUE)

How can I make R CMD check cd into the test directory before running test file?

+2  A: 

The files in tests are test against the package after it's built so I just included library('name-of-package') in the test file and it was able to build.

tommy chheng