This article explains the commands to load and save R data.
Firstly, declare data x:
x = c(1,2,3,4,5,6)
Get the local path: getwd()
path = getwd()
Change path:
pathnew = file.path(path,"Desktop")
Set the local path: setwd()
setwd(pathnew)
Save
filename = file.path(pathnew,"test.RData")
save(x,file=filename)
Clear workplace
rm(list=ls())
Load
filename = file.path(getwd(),"test.RData")
load(filename)
> x
[1] 1 2 3 4 5 6
Related Information:
沒有留言:
張貼留言