Description
This stack overflow answer of mine continue to get upvotes, so I think this is probably a roxygen2 bug
https://stackoverflow.com/questions/57396392/warning-variables-with-usage-in-documentation-object-fang-but-not-in-code/57396393#57396393
When LazyData: false
is set and you have a data object, then roxygen2 generates an invalid @usage
section that check()
complains about with the following warning:
❯ checking for code/documentation mismatches ... WARNING
Variables with usage in documentation object 'mydata' but not in code:
‘mydata’
The usage section that gets generated looks like:
\usage{
mydata
}
but to be valid when LazyData: false
is set, it should be something like:
\usage{
data(mydata)
}
I've created a test package for this bug:
https://github.com/DavisVaughan/testroxygen2usage
It is currently in a state where things are broken, i.e. check()
gives that warning. It has LazyData: false
set and a documented data set, mydata
, in mydata.R
. You can manually "fix" it in two ways:
- Set
LazyData: true
- Manually override usage with
@usage data(mydata)