Reputation: 53
I have having trouble saving objects with RStudio. Below is my console. Why does data turn out to be a string and not a vector?
> test=c(1,2,3,4,5)
> save(test,file="G:/R/Projects/Forecast Assymetry/Output/result.Rdata")
> data<-load(file="G:/R/Projects/Forecast Assymetry/Output/result.Rdata")
> data
[1] "test"
Upvotes: 1
Views: 388
Reputation: 78
Simply do
test=c(1, 2, 3, 4, 5)
save(test, file = "G:/R/Projects/Forecast Assymetry/Output/result.Rdata")
rm(test)
load(file = "G:/R/Projects/Forecast Assymetry/Output/result.Rdata")
test
This will work, you don't want to point your load to anything, it will simply conserve the object names.
Upvotes: 2
Reputation: 4432
The return value of load
(see ?load
) is
"A character vector of the names of objects created, invisibly."
which is what you are getting. There is however an object created by the name of test
already in your workspace. For example, try:
str(test)
after the load command.
Upvotes: 2