Vignette data not included

Hi,

I am drafting my vignette. Here is the question I have: I don't want to include the data used for the vignette in the package, but just want to use it for constructing vignette. Is there a good option to do so? I thought R/sysdata.rda would be an option until I found out it is not for this purpose. Hope you can shed some light. Thanks!

Maybe inst/extdata?

You can also put extra files in the vignettes directory I believe.

Thank you both. @bm5tev3 I already read Chapter 14 before asking the question. What I don't understand is If you want to show how to load raw data, put that data in inst/extdata. from the chapter. All I need is to use raw data, not to load raw data specifically. @Gabor, could you please flesh out putting files in the vignettes? How can I specify directory and load the data?

R changes the working directory to vignettes when it builds the vignette, so if you put your data file in vignettes/mydata.rds, then in the vignette you can read it with

readRDS("mydata.rds")

If you want to support R versions older than 3.5.0 then you need to save the RDS file in version 2:

saveRDS(mydata, "vignettes/mydata.rds", version = 2)
1 Like

Thank you so much @Gabor

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.