Loading and saving data.frame with `save()` seems to change object class - How's that work? Advice to avoid this


#1

Hi, If I save a data.frame (irs2) as a permanent R file and then load it back as (irs8), the file comes back as a character. What arguements am I missing? Any help would be appreciated. Anton

class(irs2)
save(irs2,file="C:/Users/Anton/Documents/BVR_MIG_II/data_in/irs6.RData")
irs8=load(file="C:/Users/Anton/Documents/BVR_MIG_II/data_in/irs6.RData")

class(irs2)
[1] "data.frame"

class(irs8)
[1] "character"


#2

Take a look at ?saveRDS and ?readRDS functions in base R. They do what you want.


#3

Thanks much. Will do.

Anton


#4

That worked. Thank you.

Anton