简体   繁体   English

将 RData 保存到不同的目录

[英]Save RData to different directory

I was using following code some time ago to save my RData files.前段时间我使用以下代码来保存我的 RData 文件。 And it was working perfectly.它运行良好。 Today when I tried it is not working.今天我试过了,还是不行。 And no errors are reported.并且没有错误报告。 Please help me to solve this issue.请帮我解决这个问题。 I want to save my R files to custom directory that is controlled by file.path.我想将我的 R 文件保存到由 file.path 控制的自定义目录中。

file.path("C:/project/data scrape/")
save(daily.data, file=(file.path("daily.usa.RData")))

Thank you very much.非常感谢。

Your file= argument is:您的file=参数是:

file.path("daily.usa.RData")

which returns:返回:

[1] "daily.usa.RData"

You need to save desired filepath as an object:您需要将所需的文件路径另存为 object:

filepath <- file.path("C:/project/data scrape")

and then do your save with然后保存

file = file.path(filepath, "daily.usa.RData")

which gives:这使:

[1] "C:/project/data scrape/daily.usa.RData"

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

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