Following advice about NAMESPACE and External Data formatting/setup, I have:
A. My data files in mypackage/data/datafilename.RData
B. The data script as mypackage/R/data.R with data files individually named and described within that one file, having just changed "itemize" to "describe" and changing the format of those item lines:
C. I've document()
-ed this, commit-pushed to github, and install_github
reinstalled locally.
Help for the data files works:
But I can't access those data, whereas I can access data in other packages using the same method:
Can anyone think why this would be? NAMESPACE doesn't include these as exports
:
But it's autogenerated by document()
so that's arguably out of my control. By comparison, mapplots
' NAMESPACE has exportPattern(".")
Environment for the package also doesn't include them, but I don't know if this is expected or not, based on lazy loading (which is true):
Any ideas welcome. I've tried data(gbm.auto:grids)
with 1, 2 & 3 colons, to no avail. Based on the answer to this related question (also by me), I get the suspicion that there might be some issue whereby only the last named object in data.R
is important/accessible?
usethis
has been created since I've been updating this package and has use_data
and create_package
but I'm reluctant to try these out since ostensibly everything in my package should already be in order and I don't want to make things worse.
Thanks in advance. Reprex would be
library(devtools)
install_github("SimonDedman/gbm.auto")
Edit: to add to this, the datasets available in the installed package are a combo of the full list, some individual, some named in datalist
:
Which contrasts against what's in the working folder and github:
As far as I can see, all the data files are the same format, e.g. when doubleclicked in file explorer they open in RStudio with the right name and same format. gbm.auto/R/data.R file is here. Per the last image, the three data files listed in datalist
can be loaded in R with library(gbm.auto) data(Juveniles)
, but the other three data files can't. If I delete/rename the existing datalist
from /data
and generate a new one with add_datalist(pkgname = getwd())
, a new file is generated but again it only lists those 3 files, not all 6.
Ugh, goddamn it. Found the issue. The 3 'bad' files had "Rdata" extensions while the 3 good ones had "RData" extensions. Lower case vs capital D. How unbelievably annoying.
Data files in data
must have .RData extensions, not .Rdata
Bug filed here.