How do I reference a model object in the example section of documentation in an R package.

I'm creating an R package. In my package project folder, I have a model object saved as a .rds file. in a folder called data. Additionally, I have a function saved in the R folder.

How do I reference the model object in the example section of documentation of the function in the R folder?

I also have the same questions for dataset files saved as .rds files in the data folder. How do I reference those datasets in the example section when documenting functions.

saved_data <- readRDS(“data.res”)

You can reference data objects by their name in the package code. See R Packages (2e) - 8  Data for more about data in packages, and also the example data packages linked from there.

1 Like