This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there any solution to reduce the size of .RData?

Because the size of ".RData" is 1.8GB I can't open the R software. Now I have to delete the unnecessary objects and reduce the size. I know it is possible to delete objects in R software but it is impossible to open R software in my computer. My question is that is there any other way to edit contents of ".RData"? I tried to edit in "Notepad" and "word", but I couldn't edit because of garbled characters.

r

This is not a bioinformatics question so you may have better luck on Stack Overflow. By default saving in RData format uses gzip compression so you won't be able to easily edit this with a text editor. I suggest you upload your file to a server with enough resources to open it with R and re-export what you need. If you don't need everything bundled, then save each object separately using saveRDS() and restore them as needed.

Thank you for answering my question. I understand. I'll try uploading, decompression or using saveRDS() method. Thank you for your help.

And...I'm sorry I asked an inappropriate question.

Is this an .Rdata file that you are generating yourself? Or is this the file that you let R maintain with your interactive R sessions? Because if its the latter then the best solution is to just stop letting R save your interactive sessions.

In your place, I would simply rename .Rdata in something like backup.Rdata, disable auto-saving of .Rdata, and start fresh with an empty R session. In most cases, it is best to proceed that way: makes your code more reproducible and avoids data congestion. If you really need to save an R object, save it explicitly as ATpoint suggested in his comment.

Thank you for answering my question. To tell the truth, my PC was got stuck with no response for half a day... I tried renaming and I could open my file! Thank you for your advice.

1 answer

I do not fully understand your problem but I guess it is how to remove objects?

You can choose what yoz save in your Rdata:

save(list = setdiff(ls(.GlobalEnv), c("MyElement1", "MyElement2")), file = "file.Rdata")

Simply list the elements from your environment that you do not want to have saved such as "MyElement1" and "MyElement" and these will be excluded.

Thank you for answering my question. I was able to solve my problem. From now on, I will keep only what I want to keep. Thank you for your advice.

Log in to answer this question.