0

I have .Rdata file that "stores" some logic/code. How can I extract the code written in this .Rdata file?

I want to edit/fix this code, but instead the general pipeline loads this .Rdata with it's variables and SVM model without the option to fix and edit.

Please advise.

P.S .Rdata saves a workspace, which includes the function and value objects created during an open session in R, I need the actual logic/code/initialization done in order to create these objects, for example I get the svm model fit result but not the code that created this object, that is what I need.

Steves
  • 39
  • 1
  • 8
  • Possible duplicate of [listing contents of an R data file without loading](https://stackoverflow.com/questions/4831050/listing-contents-of-an-r-data-file-without-loading) – Tim Biegeleisen Oct 09 '17 at 11:28
  • @TimBiegeleisen Nope, my question is asking for a way to recover the code created the objects saved in .Rdata. – Steves Oct 09 '17 at 11:33
  • I attempted an answer below. Maybe your question is not an exact duplicate, though I think it is closely related. – Tim Biegeleisen Oct 09 '17 at 11:34

1 Answers1

1

You can try loading the RData file, and listing its contents:

load("mydata.RData", verbose=TRUE)

Then, you can view the code behind the objects loaded. For instance, if you just loaded a function called myfunc you could view the definition by just entering the function's name:

myfunc
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360