简体   繁体   中英

Save RData to different directory

I was using following code some time ago to save my RData files. 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.

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

Thank you very much.

Your file= argument is:

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

which returns:

[1] "daily.usa.RData"

You need to save desired filepath as an 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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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