0

I am building an R package and in its documentation I included an example that uses two datasets (let's call them dataset1 and dataset2). I am now trying to write a documentation for these two datasets. To achieve this, I saved the two datasets in the "data" subfolder with names dataset1.RData and dataset2.RData using the save() function, and also created and a file named data.R in the "man" folder with the following content:

#' Title for dataset 1
#'
#' description for dataset1
#'
#' @name dataset1
#' @keywords dataset1
#' @docType data
#' @format An S4 object of class RasterLayer.
#' @details
#'     details for dataset1
#'
"dataset1"

#' Title for dataset 2
#'
#' description for dataset1
#'
#' @format An S4 object of class SpatialPolygonsDataFrame.
#' @name dataset2
#' @docType data
#' @details
#'     details for dataset2
#' \describe{
#'   \item{name_column_1}{description of column1}
#'   \item{name_column_1}{description of column1}
#' }
#'
"dataset2"

My package and the included examples check fine without any errors or warnings. However, when I run ?dataset1 or ?dataset2 I get the following message:

No documentation for ‘dataset1’ in specified packages and libraries: you could try ‘??dataset1’

I there anything I am doing wrong?

  • 1
    Did you run `devtools::document()` before building? Did you actually install the packages or are you using the devtools shim to load it? It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input at hat can be used to test and verify possible solutions. – MrFlick Sep 18 '21 at 20:02
  • [This post](https://stackoverflow.com/questions/2310409/how-can-i-document-data-sets-with-roxygen) might help. – Rui Barradas Sep 18 '21 at 20:02
  • You are missing an `@export`. Also you don't need a string at the end, `NULL` would do. – anymous.asker Sep 19 '21 at 04:07
  • @MrFlick `devtools::document()` did the trick. Thank you for the suggestion. I am doing this thing for the first time and learning curve is not so gentle. Please do bear with me with such rookie questions. More will come I guarantee :) – Faustin Gashakamba Sep 19 '21 at 08:58
  • I highly recommend that you read https://r-pkgs.org/ – Marek Fiołka Sep 19 '21 at 15:09

0 Answers0