[R-pkg-devel] accessing data folder Warning/Error
Iris Simmons
|kw@|mmo @end|ng |rom gm@||@com
Wed Jun 12 01:30:33 CEST 2024
Unless I'm misunderstanding, it sounds like you're storing data that your
package requires in an external location. You need to put your data into
your R package and then access that data with system.file(package =
"<pkgname>", <path within package>)
Sometimes people will make a folder inst/extdata inside their R package
directory and then dump the data that the package requires in there. You
can see this link for more information:
https://cran.r-project.org/doc/FAQ/R-exts.html#Data-in-packages
So, if you move your files into your R package, you should have a directory
inst/extdata/data-raw, and files inst/extdata/metadata,
inst/extdata/textgrid, and inst/extdata/README.md
When your package is installed, the contents of inst are unpacked into the
install directory. So, to refer to files after the package has been
installed and loaded, use:
system.file(package = "<pkgname>", "extdata", "data-raw", <more path>)
system.file(package = "<pkgname>", "extdata", "metadata")
...
On Tue, Jun 11, 2024, 19:13 Yana Outkin <youtkin1 using swarthmore.edu> wrote:
> I am currently in the process of submitting a package to CRAN. I am having
> difficulties with the example section in Summary.Rd
>
> I placed the data in a folder called data-raw, which contains a metadata
> file, textgrid file, and a README.md description of the data. This package
> builds on existing software that generate these metadata and textgrids
> files. The current package processes and plots this data.
>
> When I run the R CMD check, the working directory is set to a folder
> (.Rcheck) within the package, so I reset working directory with
> setwd(".."), to be able to access the data-raw folder. This gives a
> warning.
>
> Is there a different way I can access my example dataset?
>
> Thank you!
> Yana Outkin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list