Skip to content

kbroman/docerror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test Roxygen2 documentation of data sets

In documenting datasets with Roxygen2, you don't need to use the @name directive but can use the name of the dataset as a string after the Roxygen2 comments, like this:

#' test dataset
#'
#' a dataset for testing use of Roxygen2 to document datasets
#'
#' @docType data
#'
#' @usage data(testdata)
#'
#' @format Just the number \code{0}.
#'
#' @keywords datasets
#'
#' @examples
#' data(testdata)
"testdata"

But, this seems to require LazyData: true in the DESCRIPTION file.

Branch master

  • The dataset is documented as above
  • I don't include LazyData: true in the DESCRIPTION file.

When I run

R -e 'library(devtools);document()'

I get the following error:

> library(devtools);document()
Updating docerror documentation
Loading docerror
Error: Failure in roxygen block beginning testdata-data.R:1
object 'testdata' not found
Execution halted
make: *** [doc] Error 1

Branch no_error

  • The dataset is documented as above
  • And I include LazyData: true in the DESCRIPTION file.

When I run

R -e 'library(devtools);document()'

everything is fine.

But when I run

R -e 'library(roxygen2);roxygenise()'

I get the following error:

> library(roxygen2);roxygenise()
Error: Failure in roxygen block beginning testdata-data.R:1
object 'testdata' not found
Execution halted
make: *** [roxygenise] Error 1

Branch use_name

  • The documentation of the dataset is modified to include #' @name testdata, and I replace the final line ("testdata") with NULL.

  • I don't include LazyData: true in the DESCRIPTION file.

Either of the following works without error.

R -e 'library(devtools);document()'
R -e 'library(roxygen2);roxygenise()'

My session info

> devtools::session_info()
Session info------------------------------------------------------------------------------------------------------
 setting  value
 version  R version 3.1.1 (2014-07-10)
 system   x86_64, darwin13.1.0
 ui       X11
 language en
 collate  C
 tz       America/Chicago

Packages----------------------------------------------------------------------------------------------------------
 package    * version    date       source
 devtools   * 1.6.0.9000 2014-09-24 Github (hadley/devtools@51ebc3a)
 rstudioapi   0.1        2014-03-27 CRAN (R 3.1.0)

About

R package to test roxygen2 documentation of datasets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages