Loading the files in the Source panel on one computer into the Source panel on second computer

I am using Rstudio (Version 1.2.5042) projects on two machines and I have a set of files loaded in the Source panel on one donor computer. I copy the whole project directory to another recipient computer, including the proj.Rproj directory. I can confirm that the INDEX file from the donor computer is on the recipient computer. However, when I open the project on the recipient computer, it ignores the folder containing the INDEX from the donor, even though it is in the most recent directory in proj.Rproj. Instead, a new directory is created in proj.Rproj on the recipient computer.

Is there some way of conveniently achieving this transfer of the project history?

Thanks in advance for any help,

Chris

Perhaps you can make a GitHub account and use it for version control as well as letting you pull the GitHub hosted project onto any local work machine you have access to.

Thank you for your suggestion nirgrahamuk. I do have Github projects, as well as many that are not. I have the directories replicated on multiple machines. That is not the problem. It is how RStudio behaves with respect to the files stored in the proj.Rproj file. It seems to choose the history directory last used on the machine that you are working on, even if you copy a history directory with a later timestamp into the proj.Rproj directory. That is, RStudio on a particular machine seems to know the history directories that have been saved on that machine.

I think that it would be possible to rename history directories to fool RStudio, but that is a hack that is rather messy. I would prefer something more straightforward.

Cheers, Chris

sorry, when reading I somehow missed you asked about history.
The history pane in the project can be saved and loaded with the buttons there.
image

No worries, it is a bit of an obscure problem. Hopefully the screenshot and the explanation below will make it clearer.

In the screenshot I am displaying a directory in the .Rproj.user directory on a computer that has been copied onto it from a second computer. You can see that the prop subdirectory has an INDEX file. This file contains a list of all the files that were open in the Source panel when I last closed this project in RStudio on the second computer. The following is an example of an entry that shows that I had a file called plotResults.R open (there are other files listed in INDEX):

d%3A%2FAnalyses%2FResearch%2FTPA%2FGrowth%20analysis%2FplotResults.R="4D133B9F"

If I open this project on this computer, then no files are loaded because I have not loaded any files into the Source panel on this computer for this project. On exiting the project a new directory is added to .Rproj.user, the name being 15CDAC0A.

Ideally, RStudio would use the INDEX file in D:\Analyses\Research\TPA\Growth analysis.Rproj.user\B830CA0C on the current computer to open all the files in the Source panel that had been open on the second computer. I cannot see a straightforward way to do this.

Cheers, Chris

There is no official way to do this, but here's an unofficial way.

First, close ALL copies of RStudio.

Next, observe the folder name under .Rproj.user:

Now, open the file %localappdata%\RStudio-Desktop\monitored\user-settings\user-settings, and change the contextId value to the ID you observed above.

Open RStudio and you'll have all your open files back.

Notes:

  1. It is only safe to do this if your computers will not try to access files at the same time. RStudio creates unique context IDs so that you don't wind up with conflicts.
  2. If all you are trying to do is restore unsaved content, you can use the rsrecovr package instead: https://github.com/jmcphers/rsrecovr

Jonathan,

Thanks so much for your response. It was just the sort of tip that I was hoping for. It will save me a lot of work.

I take your point about simultaneous access.

One other small question. Is it safe to delete older subdirectories in .Rproj.user, not within B830CADC, but alongside it?

Once again, thanks for your help, Chris

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.