How to access script / source history in RStudio?

I would like to access the history of what was printed on the source panel in RStudio.

I'm interested in a way to learn and enter code. Three things that I would like to analyze are: i) the way that one person is encoded, ii) how different types of people enter the code, iii) the way a newbie improves typing.

Capturing the history of commands quite satisfies the first attempt in this way, but I would like to achieve finer granularity and, thus, access sequential changes on one line in a sense.

So, to be clear, I'm not looking for a history of commands or for the difference between the different versions and .R .

What I would like to get is really sequential changes to the original panel, which are visible when you recursively press Ctrl+Z I don’t know if there is a more accurate word for what I am describing, but again I am interested in how bits of code are added / moved / deleted / corrected in the original panel, but are not necessarily transmitted to the console and, therefore, are absent in the command history.

It must be somewhere / somehow saved by RStudio, as it is available later. This can be stored in a rather hidden / private / memory / process / ..., and I have a very vague idea of ​​how the GUI works. I don’t know if it was easily accessible and then programmatically analyzed, usually if we could save the file from it. Timestamps would be a cherry on top, but I would be happy without it.

Do you have an idea how to access this story?

+7
r rstudio
source share
1 answer

The original RStudio panel is essentially a view of the Ace editor. Thus, you will need to access the editSession editor and use getDocument or getWordRange along with canceling the undosManager editSession instance.

I don’t think that you will do this from RStudio without breaking the RStudio code if the RStudio Addin api is not executed to transmit events in the future.

It might have been easier to record a session recorder as you make changes, rather than trying to spoil the cancellation history. I assume that you can write Addin that calls javascript to communicate through the existing RStudio port using Ace Editor events (i.e.OnChange).

+4
source share

All Articles