[R] Saving an edited function in R Studio

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Jan 13 02:41:44 CET 2015


The usual answer is "don't do that."

Always use a text editor to change your code on disk and re-load it by sourcing it or building it into a package. This makes sure your changes make it back to the hard disk where they came from to begin with, since the edit function only "saves" them back into your workspace.

This also eliminates the confusion of modifying nested functions separately from the functions they are nested in, since the whole function is redefined at once.

Please post in plain text, per the Posting Guide mentioned in the footer of this or any other list message. This will avoid our seeing a mangled version if your message and being perplexed.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On January 12, 2015 2:29:44 PM PST, "Tae J. Kwon" <tkwon at uwaterloo.ca> wrote:
>Hello,
>
>I am trying to modify a few functions in a specific R package that I
>installed. I am using a simple "edit" function to edit the function and
>override the exisiting using the same function name. For instance, if
>the
>function is named as "aaaMap" then I do: aaaMap = edit(aaaMap) so other
>functions that are built within "aaaMap" won't be affected.
>
>So when editing, a window pops up with an option of saving the changes
>made
>by clicking the "save" button at the bottom of the popup window. By
>making
>changes this way I was able to run the code in a way that I changed..
>But
>when I do the exactly same for another function named "bbbMap" (nested
>inside aaaMap), a different pop-up window appears (notepad) WITHOUT an
>option of saving the changes made. I tried saving the changes but after
>running the code, I realized that the changes have NOT been
>made/saved..
>Any idea why editing one function enables "save" option while another
>doesn't?
>Your answer is greatly appreciated...
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list