We provide here only instructions for Debian-based distributions. Feel free to contribute to this document to provide up-to-date information for other distributions (e.g., RedHat, Fedora).
Today, the stable versions of the most common distributions provide recent enough versions of R:
If your distribution is older than this, well, it may be a good time for upgrading…
First, you need to install the R language and convenient packages by running (as root):
apt-get update ; sudo apt-get install r-base r-cran-knitr r-cran-ggplot2
Alternatively, if the installation of r-cran-gplot2
or r-cran-knitr
fails, you may want to install them locally (through the R packaging
system) and manually by running the following commands in R (or
RStudio):
install.packages("knitr") install.packages("ggplot2")
If you plan to export pdf documents with LaTeX, you probably also want to run (as root):
apt-get update ; apt-get install texlive-base
RStudio is unfortunately not packaged within Debian so the easiest is to download the corresponding Debian package on the RStudio webpage and then to install it manually (you may have to adjust the version number in the following example). Here is how to install it:
cd /tmp/ wget https://download1.rstudio.org/rstudio-xenial-1.1.453-amd64.deb sudo dpkg -i rstudio-xenial-1.1.453-amd64.deb sudo apt-get update ; sudo apt-get -f install # to fix possibly missing dependencies
Some instructions on installing R and knitr must be missing. This should be tested and improved.
knitr
and ggplot2
:install.packages("knitr", dep=TRUE) install.packages("ggplot2", dep=TRUE)
The RStudio team has created a lot of very good material and tutorials. You should definitively look at the Cheat sheets webpage. In particular you may want to have look at the following ones:
In case it helps, here are some (sometimes outdated) French versions of these documents:
If you have never used git with RStudio, we strongly advise that you follow our tutorial on using git from RStudio ("RStudio et Gitlab" in French). Before proceeding, make sure you also have followed the "git/GitLab configuration" tutorial (in French).
Alternatively, you may want to watch this video (in English). If you do not like videos, you should have a look at the step-by-step explanations from Software Carpentry. It comes with many screenshots and is quite progressive.
Open RStudio and do the following steps:
Create a new version controled project: File / New Project / Version Control
Get the URL from your GitLab repository:
Indicate this URL in the "Repository URL" field (you may want to
prefix this URL with xxx@
where xxx
is your Gitlab id to avoid
repeatedly giving it later on).
RStudio should restart in a mode related to Git:
Module2/exo1/toy_document.Rmd
and perform a simple
modification.Go to the Git menu to commit
Select the lines to commit and then click on commit
Your modifications have now been commited on your local machine. They haven't been propagated to GitLab yet.
Click on push
to propagate them on GitLab
NB: You won't be able to propagate your modifications on GitLab if
some modifications have been done on GitLab in the meantime.
pull
to get these modifications on your machine.