I am working on an R package that has some functions that I want to test (locally) on data that I cannot distribute because the data source is patented.
I have a folder ( paid_projections
) where I store these files. This caused some initial difficulties in executing devtools::test()
and checking the R CMD, I think, due to the subtle differences in the working directory that these utilities saw.
I solved this problem by installing tests with some special fixes for the path:
spec_file <- file.path('paid_projections', 'pod_projections.xlsx')
file_loc <- file.path(getwd(), spec_file)
#for CMD check
file_loc <- gsub('.Rcheck', '', file_loc, fixed = TRUE)
#for devtools::test()
file_loc <- gsub('tests/testthat/', '', file_loc, fixed = TRUE)
ex <- read_raw_pod(file_loc)
It's ... less than ideal, and I make me go take a shower. It creates the behavior that I want (I can run these tests in the console using devtools::test()
either the R CMD test), but this does not seem to be the right solution.
There is a team there devtools::wd()
that seems to be useful here, but I couldn’t understand how this could replace the white morning. I would like to love any suggestions!
source
share