deadletter
deadletter

Reputation: 25

Edit does not save function in newly updated R 3.2.2

The more formal operator saves the changes to the function:

function_I_want_to_edit <- edit()

This opens the editing window and I can make changes which are there when I re-open it.

However, if I simply try:

edit(function_I_want_to_edit)

It opens the editing window but it does not appear to have saved my changes when I re-open it. This is in RStudio, newly updated to Version 3.2.2.

I can't tell if it always worked like this or not, because I believe I was able to change one thing, and then it stopped working.

Has anyone noticed a similar problem with edit or fix?

Upvotes: 2

Views: 2276

Answers (1)

blep
blep

Reputation: 726

Yes, this appears to be the intended behavior. If you look at the help for edit:

It is important to realize that edit does not change the object called name. Instead, a copy of name is made and it is that copy which is changed. Should you want the changes to apply to the object name you must assign the result of edit to name. (Try fix if you want to make permanent changes to an object.)

fix does save the changes I make to a function.

Upvotes: 3

Related Questions