[R-pkg-devel] dateset with roxygen2?

Spencer Graves @pencer@gr@ve@ @end|ng |rom e||ect|vede|en@e@org
Wed Sep 24 14:47:04 CEST 2025


Hello, All:


How does one document a dataset with roxygen2?


I've recently read Wickham and Bryan, R Packages (2e).[1] I've tried to 
do what they say there, and R CMD check is reporting:


  Variables with usage in Rd file 'MaddisonCountries.Rd' but not in code:
     ‘MaddisonCountries’


This is in "https://github.com/sbgraves237/SS4Maddison".


Suggestions? Thanks, Spencer Graves


p.s. Wickham and Bryan Section 7.1.2 says, "Objects in data/ are always 
effectively exported .... . This means that they must be documented. ... 
[Y]ou document the name of the dataset and save it in R/. For example, 
the roxygen2 block used to document the who data in tidyr is saved in 
R/data.R ... . There are two roxygen tags that are especially important 
for documenting datasets: @format ... @source


They give an example of a "who" dataset in tidyr. I've studied that 
example without finding what I'm doing wrong.[2]


In addition, I need to specify Roygen and "LazyData: true" in DESCRIPTION.


[1] Wickham and Bryan, R Packages online at:


https://r-pkgs.org/


Chapter 7 deals with Data:


https://r-pkgs.org/data.html


[2] "data.R" in tidyr is available at:


https://github.com/tidyverse/tidyr/blob/main/R/data.R



More information about the R-package-devel mailing list