Alan
Alan

Reputation: 681

RStudio - Compression when saving environment

Is there a way to set the options in such that when it saves my environment to an .RData file, it doesn't use compression by default?

I guess I can manually use save.image() to do this (with or without compression as needed), but I'd prefer to do this for me if possible.

Thank you.

Upvotes: 0

Views: 473

Answers (1)

user2554330
user2554330

Reputation: 44957

I'm not certain that RStudio always uses the standard code to save the image, but plain R uses the save.image function to save, and you can set the defaults for the arguments version, ascii, compress, and safe to that function using

options(save.image.defaults = args)

where args is a list giving the defaults you want. So you'd want

options(save.image.defaults = list(compress = FALSE))

A quick test suggests that this works in RStudio too.

However, I have to point out that using save.image is generally a bad idea. You should save particular objects that need saving, but wholesale saving can cause confusion when R starts up with unexpected contents in the global environment.

Upvotes: 0

Related Questions