简体   繁体   English

可以将R代码文件与.RData对象一起保存以进行版本控制吗?

[英]Can you save R code files with .RData objects for version control?

There is no version control at my work (we have an outdated, centralized system with sensitive patient information, so we can't save things outside of it). 我的工作没有版本控制(我们有一个过时的集中式系统,带有敏感的患者信息,因此我们无法将其保存在外部)。 When I save a .RData file from a script, I would like to be able to save the exact version of that .R file with it at that time. 当我从脚本中保存.RData文件时,我希望能够同时保存该.R文件的确切版本。 Is there a way to do this? 有没有办法做到这一点? Eg if I have an R script "run_analysis.R" that has the line 例如,如果我有一行R脚本“ run_analysis.R”

save(data,file='foo.RData')

Is there a way I can do something like 有什么办法可以做

save(data,run_analysis.R,file='foo.RData')

so that if I pull up the data file a year later I'll know exactly what code was used to create it? 这样,如果一年后提取数据文件,我将确切地知道创建该文件所使用的代码是什么?

you could zip the foo.RData file together with the run_analysis.R file and store the zipped file. 您可以将foo.RData文件与run_analysis.R文件一起压缩并存储压缩后的文件。

the CRAN package [zip] ( https://cran.r-project.org/web/packages/zip/zip.pdf ) can be used to create the zip file from within r. CRAN包[zip]( https://cran.r-project.org/web/packages/zip/zip.pdf )可用于在r中创建zip文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM