I am writing the R package and trying to use external files. I placed it in inst/extdata
and use system.file("extdata", "file.csv", package = "mypackage")
to load the file in my function. The official manuals describe only this way to get data from inst/extdata
.
But during building I got the error
ERROR: hard-coded installation path: please report to the package maintainer and use '--no-staged-install'
Forums said that system.file()
is bad practice, but how I should use row data in my package?
This problem is occurred after updates in 2018. I found that I can use StagedInstall: no
in DESCRIPTION file, but this is cheating, isn't it?
I want to use raw files inside functions (as precalculated static tables) and in examples as input files. My R version is 3.6.2.
system.file()
call somewhere? Or how are you using it? – Shamefacedsystem.file()
inside my function. But now I can't pass the CMD check. – Mealiesystem.file
as long as it's not at the top level of your code. – Shamefaced