Page MenuHomec4science

Rstudio integration with c4science
Updated 2,705 Days AgoPublic

Version 4 of 9: You are viewing an older version of this document, as it appeared on Oct 31 2016, 10:37.

We will explain here 2 use cases:

Both use cases need SSH keys to be already set up.

You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio.

While working on Rstudio on your files, associate your work with a project with the New Project dialog: File -> New project

and choose Existing directory

Choose the directory (if you launched Rstudio from it it should be already there) and Create project. This, in pracctice, will create an .Rproj file and modify your .gitignore (check it out with git diff .gitignore)

The system is smart enough to detect if you are using Git. On the bar, you should see a small "Git" icon.

From the Git icon, you can do all the common Git operations you would do on the command line.

Committing

If you choose Git -> commit..., you will be presented with the "Review Changes" panel, which is pretty straightforward. You tick the files you want to "Add", add a commit message and click commit. Once this is done, you can click on "Push".

Setting up from scratch

You first need to create a repository on C4science.

From within Rstudio, you create a new project with File -> New Project, choose New directory. You then have to pick the type of Project (standard, package, shiny). If you are familiar with R, you'll know what to choose. If you're not, choose Empty Project. Choose a directory name etc and tick the Create a git repository box.

What you have done here included a git init on the Rproject folder. You should now see a Git symbol on the toolbar.

You can now work on your files and commit, but you need to add an origin to be able to push to c4science: type the following on your command line, from within the R Project directory:

git remote add origin ssh://git@c4science.ch/diffusion/997/simplegitrepo.git

Change the ssh:// URL to whatever is your repo's URL. Now you can push your commits to C4science.

Last Author
rezzonico
Last Edited
Oct 31 2016, 10:37

Event Timeline

rezzonico created this document.Oct 31 2016, 09:30
rezzonico edited the content of this document. (Show Details)
rezzonico edited the content of this document. (Show Details)
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 10:25
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 10:37
rezzonico changed the visibility from "rezzonico (Vittoria Rezzonico)" to "Public (No Login Required)".
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 10:51
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 11:12
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 11:20
rezzonico edited the content of this document. (Show Details)Oct 31 2016, 11:25
rezzonico edited the content of this document. (Show Details)
aubort changed the edit policy from "c4science (Project)" to "Restricted Project (Project)".Dec 16 2016, 16:51