How to load .Rdata from an R package?

I am developing an R package. In the package, I stored some .Rdata file from the simulation results. Now I would like to load/use those .Rdata in the rmarkdown so that I can write vignettes. I can load those data from my computer. But my question is how do I load data from my own package directory? Because in the future some users of the package may need to follow the same code from the vignette and reproduce the results or plots.


Assuming you used devtools::use_data() , you can use library(YOUR_PACKAGE); data("dataset") library(YOUR_PACKAGE); data("dataset") in your vignette, where "dataset" is the data you're talking about. Running devtools::load_all() will make the data available to you as you are writing the vignette.

链接地址: http://www.djcxy.com/p/38340.html

上一篇: 如何将图像保存在R闪光灯功能中

下一篇: 如何从R包加载.Rdata?