Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is .Rproj.user/ and can I safely delete it?

Tags:

r

rstudio

.Rproj.user/ is causing spamming on each git commit e.g.

    modified:   .Rproj.user/CE897349/sources/prop/238F1188
    modified:   .Rproj.user/CE897349/sources/prop/3B42583E
    modified:   .Rproj.user/CE897349/sources/prop/6FD5F454
    modified:   .Rproj.user/CE897349/sources/prop/B1FA156F
    modified:   .Rproj.user/CE897349/sources/prop/CA32C405
    modified:   .Rproj.user/CE897349/sources/prop/INDEX

These 'changes' don't seem important, e.g.

{
    "cursorPosition" : "19,0",
    "scrollLine" : "12",
    "tempName" : "Untitled3"
}

How did I get this directory in the first place, can I delete it (and preferably not have it return or appear in future projects)?

Note: the project is an R package.

like image 730
stevec Avatar asked Sep 04 '19 14:09

stevec


3 Answers

As written on the official Rstudio page, the .Rproj.user stores some «project-specific temporary files (e.g. auto-saved source documents, window-state, etc.)». In other words, this directory is created along any R Project you make.

These files contain information related to some project options, such as:

  • Restore .RData into workspace at startup;
  • Save workspace to .RData on exit;
  • Always save history (even when not saving .RData).

I have configured my ~/.gitconfig file to have this directory always ignored when I start a local git repository. For how to do that, please look at this answer on StackOverflow. In other words: it's completely safe to have it ignored in your .gitignore file.

As far as deleting the directory is concerned, I never tried it. I guess it will get rid of any custom setting for your projects, perhaps reverting to default ones.

like image 174
baggiponte Avatar answered Nov 10 '22 14:11

baggiponte


I have the same problem with dropbox, and it seems that You can simply delete it. However You may lose your saved environment, but then You can just run everything from start again

like image 32
Jørgen K. Kanters Avatar answered Nov 10 '22 15:11

Jørgen K. Kanters


.Rproj.user is a hidden directory where project-specific temporary files (e.g. auto-saved source documents, window-state, etc.) are stored.

If you delete it, you will not access to your history or these temporary files. Your project will still work - Rstudio will recreate the directory when you open the project.

https://support.rstudio.com/hc/en-us/articles/200526207-Using-RStudio-Projects

like image 1
BMLopes Avatar answered Nov 10 '22 16:11

BMLopes