I have been using RStudio IDE for some time now and and I have not been able to clarify why the following is happening.
Let's say I have some functions created by myself and loaded into the environment by "sourcing" the corresponding script.
Once loaded into the environment, I ofently want to modify the function and I click "F2" to "Go To function Definition" and from there I am directly able to modify the function, save the script and re-source to have the function updated and running.
Many times, I have no clue why this might happen, instead of going to the function within the script in editable mode, RStudio just opens the function in "View" mode with the icon glasses. It is not the script in which function was defined, but just the function code with no possible editing.
When this happens it is kind of annoying because I have to manually find the script where the function is defined, open it and edit it .
Is there any explanation on why sometimes it leads me to the script and sometimes it leads me to the View mode when I press F2 "Go To Function definition"? I would like to understand what triggers one behaviour or another to try to work always on the go to edit mote.