Behzod A
Behzod A

Reputation: 303

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.

Upvotes: 2

Views: 1624

Answers (1)

bs93
bs93

Reputation: 1316

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"

Upvotes: 1

Related Questions