How to save() with a particular variable name

My preference is to avoid the name in the RData file on load:

obj = local(get(load('myfile.RData')))

This way you can load various RData files and name the objects whatever you want, or store them in a list etc.


You really should use saveRDS/readRDS to serialize your objects. save and load are for saving whole environments.

saveRDS(this.csv.data, saved_file_name)
# later
mydata <- readRDS(saved_file_name)

Just name the arguments you use. With your code the following works fine:

save(list = this.csv.data$unique_tag, file=saved_file_name)

Tags:

R