Reading and Saving data file in R session

Suppose you want to save an individual object in R and read it later.

Saving data file in R session
saveRDS(mydata, "logistic.rds")
Reading stored data from R session
mydata = readRDS("logistic.rds")
Note : You can define any name other than mydata.

Another way : Saving data file in R session
save (mydata,file="E:\\logistic.rdata")
Loading stored data from R session
load("E:\\logistic.rdata", ex <- new.env())
ls(ex)
Saving multiple objects in R session
save(mydata, data2, file="1.RData")
Saving everything in R session
save.image(file="1.RData")
About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 8 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Telecom and Human Resource.

Related Posts:
1 Response to "Reading and Saving data file in R session"
  1. How does Is(ex) work? And how are you ensuring that the dataset us being loaded in new environment?

    ReplyDelete

We have Zero Tolerance to Spam. Comments with links will be deleted immediately upon our review.

Next → ← Prev
Love this Post? Spread the Word!
Share