Reputation: 21
I am trying to run an R script that I've inherited from a colleague. This script references a .rds file called config.rds. It stores some configuration settings. I need to change those settings. However, when I attempt to open the file in the Rstudio editor, a "Load R object" prompt pops up. I cannot figure out how to open the file for editing.
Upvotes: 2
Views: 5069
Reputation: 94307
You can't open the file for editing - it is a binary file that stores the internal representation of R data objects.
You can only really read it into R to create a new R object, and then save a modified copy of that R object into a new or (the same) .RDS file. Example:
config = readRDS("config.rds")
config$username = "fnord"
saveRDS(config, "config.rds")
Upvotes: 4