一段时间以前,我构建了一个自定义R程序包,该程序非常有用。现在,我有了一个已配置用于多个项目的数据集。我将脚本sample_pop.R
放入包中的/R
中,并成功运行了该脚本,以将RData
df保存到/data
目录中。
当我重建时,出现以下错误:
Warning: file 'sample_pop.RData' has magic number 'X' Use of save versions prior to 2 is deprecated
Error in load(zfile, envir = envir) :
bad restore file magic number (file may be corrupted) -- no data loaded
这是将数据添加到R包中的正确方法,以便我可以像通过diamonds
库访问ggplot
一样访问自己的数据吗?
library(ggplot2)
diamonds %>% head()