简体   繁体   中英

How to see original script or function from RData?

I created a very small script (without saving) in RCmdr top window, but I only saved the workspace.

When I reload this I can't see anything that was in the top window originally. My mistake I know, but is there a way to see any hint of the functions etc I may have called, from the workspace file? I can see the objects - but not what created them.

If you open a new R session, try hitting the up-arrow keys. The normally invisible .Rhistory file is usually loaded at the start of a new session if the prior session ended normally. If the session is open in a GUI hten you may be able to display the list of commands with a menu command. This may also display that file:

loadhistory(file = ".Rhistory")

The history is cumulative, so unless you had a really long session intervening you may still be able to get code going back for several session. I think it keeps the last 500 entries by default. Actually turns out to be 512. See:

?history

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM