Commit 360f853b authored by Laurence Farhi's avatar Laurence Farhi

séparation de la doc rstudio en 2 docs : install et doc / interaction git

parent 226d155c
......@@ -21,6 +21,10 @@
./module2/ressources/jupyter_fr.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/8dcce91be83c4ece834abfa98b8bbfb1
./module2/ressources/rstudio.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/rstudio_fr.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/rstudio-install-doc.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/rstudio-install-doc_fr.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/rstudio-git.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/rstudio-git_fr.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/09d339f009cd4b45a468583ab7730221
./module2/ressources/gitlab.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/448cd6f9018545d1a67405551add6fda
./module2/ressources/gitlab_fr.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/448cd6f9018545d1a67405551add6fda
./module2/ressources/emacs_orgmode.org # https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/954f94ce4f9a4d858d47b41793cc96c8
......
# -*- mode: org -*-
#+TITLE: Using Git from RStudio
#+DATE: June, 2018
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
* Table of Contents :TOC:
- [[#to-begin][To begin]]
- [[#cloning-a-repository][Cloning a repository]]
- [[#modifying-a-file][Modifying a file]]
* To begin
If you have never used git with RStudio, *we strongly advise that you
follow [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/d132a854b0464ad29085cedaded23136][our tutorial on using git from RStudio]]* (/"RStudio et Gitlab"/
). Before proceeding, make sure you also have followed the
*[[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/7508aece244548349424dfd61ee3ba85]["git/GitLab configuration" tutorial]]*.
Alternatively, you may want to watch [[https://www.youtube.com/embed/uHYcDQDbMY8][this video]] (in English). If you
do not like videos, you should have a look at the [[https://swcarpentry.github.io/git-novice/14-supplemental-rstudio/index.html][step-by-step
explanations from Software Carpentry]]. It comes with many screenshots
and is quite progressive.
* Cloning a repository
Open RStudio and do the following steps:
- Create a new version controled project: =File / New Project / Version Control=
#+BEGIN_CENTER
[[file:rstudio_images/new_project.png]]
[[file:rstudio_images/git.png]]
#+END_CENTER
- Get the URL from your GitLab repository:
#+BEGIN_CENTER
[[file:rstudio_images/adresse_depot.png]]
#+END_CENTER
- 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/).
#+BEGIN_CENTER
[[file:rstudio_images/clone.png]]
#+END_CENTER
- If you're behind a proxy, git should be configured
accordingly. Check the [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/7508aece244548349424dfd61ee3ba85]["Dealing with proxies" section]].
- Git will then connect to Gitlab and fetch a whole copy of the
repository.
- RStudio should restart in a mode related to Git:
#+BEGIN_CENTER
[[file:rstudio_images/rstudio.png]]
#+END_CENTER
- The file manager on the right, allows you to browse the version
controled repository.
* Modifying a file
- Open =Module2/exo1/toy_document.Rmd= and perform a simple
modification.
- Save
- Go to the Git menu to commit
#+BEGIN_CENTER
[[file:rstudio_images/commit.png]]
[[file:rstudio_images/commit2.png]]
#+END_CENTER
- Select the lines to commit and then click on =commit=
#+BEGIN_CENTER
[[file:rstudio_images/commit5.png]]
#+END_CENTER
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
#+BEGIN_CENTER
[[file:rstudio_images/push.png]]
[[file:rstudio_images/push2.png]]
[[file:rstudio_images/push3.png]]
#+END_CENTER
*NB*: You won't be able to propagate your modifications on GitLab if
some modifications have been done on GitLab in the meantime.
[[file:rstudio_images/push4.png]]
- You should first merge these remote modifications locally. Click on
=pull= to get these modifications on your machine.
# -*- mode: org -*-
#+TITLE: Utiliser Git avec RStudio
#+DATE: June, 2018
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
* Table des matières :TOC:
- [[#pour-commencer][Pour commencer]]
- [[#Cloner-un-dépôt][Cloner un dépôt]]
- [[#modifier-un-fichier][Modifier un fichier]]
* Avant de commencer
La première chose à faire est de configurer Git sur votre
ordinateur. Pour ce faire, vous pouvez suivre la vidéo
[[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/7508aece244548349424dfd61ee3ba85][configurer Git pour Gitlab]] et le document
[[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/gitlab_fr.org][Git et Gitlab]] correspondant.
Vous pourrez alors utiliser Git avec RStudio. Pour ce faire, vous
pouvez suivre la vidéo [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/d132a854b0464ad29085cedaded23136][RStudio - Gitlab]] dont les étapes
sont reprises ci-dessous.
/(Nous vous signalons aussi cette/ [[https://www.youtube.com/embed/uHYcDQDbMY8][vidéo]] /(en anglais) ainsi que le/ [[https://swcarpentry.github.io/git-novice/14-supplemental-rstudio/index.html][tuto
pas à pas]] /(en anglais) de Software Carpentry.)/
* Cloner un dépôt
Ouvrir RStudio et procéder comme suit :
- Créer un nouveau projet sous contrôle de version : =File / New Project / Version Control=
#+BEGIN_CENTER
[[file:rstudio_images/new_project.png]]
[[file:rstudio_images/git.png]]
#+END_CENTER
- Récupérer l'URL du dépôt Gitlab
#+BEGIN_CENTER
[[file:rstudio_images/adresse_depot.png]]
#+END_CENTER
- Indiquez cette URL dans le champ "Repository URL" /(vous voudrez/
/peut-être préfixer cette URL avec =xxx@= où =xxx= est votre identifiant/
/Gitlab pour éviter d'avoir à le ressaisir ultérieurement)/.
#+BEGIN_CENTER
[[file:rstudio_images/clone.png]]
#+END_CENTER
- Si vous êtes derrière un proxy, il faut le définir dans Git (voir le
paragraphe "Gérer les proxy" de la page sur [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/7508aece244548349424dfd61ee3ba85][Git et Gitlab]]).
- Git se connecte à Gitlab et récupère une copie complète du dépôt.
- RStudio redémarre dans un mode lié à Git :
#+BEGIN_CENTER
[[file:rstudio_images/rstudio.png]]
#+END_CENTER
- Le gestionnaire de fichiers à droite vous permet de parcourir le
dépôt sous contrôle de version.
* Modifier un fichier
- Ouvrir le fichier =Module2/exo1/toy_document.Rmd= et le modifier.
- Enregistrer.
- Aller dans le menu Git pour effectuer le commit.
#+BEGIN_CENTER
[[file:rstudio_images/commit.png]]
[[file:rstudio_images/commit2.png]]
#+END_CENTER
- Sélectionner les lignes à commiter puis cliquer sur =commit=.
#+BEGIN_CENTER
[[file:rstudio_images/commit5.png]]
#+END_CENTER
Les modifications ont été commitées uniquement sur la machine. Elles
n'ont pas été propagées sur Gitlab.
- Cliquer sur =push= pour les propager sur Gitlab.
#+BEGIN_CENTER
[[file:rstudio_images/push.png]]
[[file:rstudio_images/push2.png]]
[[file:rstudio_images/push3.png]]
#+END_CENTER
N.B. : Vous ne pouvez pas propager vos modifications sur GitLab si
des modifications ont été faites sur GitLab entre-temps.
#+BEGIN_CENTER
[[file:rstudio_images/push4.png]]
#+END_CENTER
- Il faut d’abord récupérer ces modifications distantes sur votre
machine locale. Pour ce faire cliquer sur =pull=.
# -*- mode: org -*-
#+TITLE: Rstudio: installating and documentation
#+DATE: June, 2018
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
* Table of Contents :TOC:
- [[#installing-rstudio][Installing RStudio]]
- [[#linux-debian-ubuntu][Linux (debian, ubuntu)]]
- [[#mac-osx-and-windows][Mac OSX and Windows]]
- [[#rstudio-documentation][RStudio documentation]]
* Installing RStudio
** Linux (debian, ubuntu)
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:
- Debian (stretch) ships with [[https://packages.debian.org/stretch/r-base][R 3.3.3-1]], [[https://packages.debian.org/stretch/r-cran-knitr][knitr 1.15.1]], and [[https://packages.debian.org/stretch/r-cran-ggplot2][ggplot 2.2.1]]
- Ubuntu (bionic 18.04) ships with [[https://packages.ubuntu.com/bionic/r-base][R 3.4.4]], and [[https://packages.ubuntu.com/bionic/r-cran-knitr][knitr 1.17]], and [[https://packages.ubuntu.com/bionic/r-cran-ggplot2][ggplot 2.2.1]]
- Ubuntu (artful 17.04) ships with [[https://packages.ubuntu.com/artful/r-base][R 3.4.2]], and [[https://packages.ubuntu.com/artful/r-cran-knitr][knitr 1.15]], and [[https://packages.ubuntu.com/artful/r-cran-ggplot2][ggplot 2.2.1]]
If your distribution is older than this, well, it may be a good time
for upgrading...
*** Installing R
First, you need to install the R language and convenient packages
by running (as root):
#+BEGIN_SRC shell
apt-get update ; sudo apt-get install r-base r-cran-knitr r-cran-ggplot2
#+END_SRC
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):
#+BEGIN_SRC R
install.packages("knitr")
install.packages("ggplot2")
#+END_SRC
If you plan to export pdf documents with LaTeX, you probably also want
to run (as root):
#+begin_src sh :results output :exports both
apt-get update ; apt-get install texlive-base
#+end_src
*** Installing RStudio
RStudio is unfortunately not packaged within Debian so the easiest is
to download the corresponding Debian package on the [[https://www.rstudio.com/products/rstudio/download/#download][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:
#+BEGIN_SRC shell
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
#+END_SRC
** Mac OSX and Windows
- Install R and Python following the instructions given in a [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/19c2b1de7766484bae73f3ab133463c6][separate resource]].
- Download and install RStudio from the [[https://www.rstudio.com/products/rstudio/download/#download][RStudio webpage]] by choosing the right operating system.
- Download and install MiKTeX from the [[https://miktex.org/download][MiKTeX webpage]] by choosing the right operating system. You will be prompted to install some specific packages when exporting to pdf.
- Open RStudio and type the following commands in the console to install =knitr= and =ggplot2=:
#+BEGIN_SRC R
install.packages("knitr", dep=TRUE)
install.packages("ggplot2", dep=TRUE)
#+END_SRC
* RStudio documentation
The RStudio team has created a lot of very good material and
tutorials. You should definitively look at the [[https://www.rstudio.com/resources/cheatsheets/][Cheat sheets
webpage]]. In particular you may want to have look at the following
ones:
- [[https://github.com/rstudio/cheatsheets/raw/master/rstudio-ide.pdf][The RStudio IDE]],
- [[https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf][R Markdown]] (here is also a [[https://rmarkdown.rstudio.com/][nice step-by-step presentation of Rmarkdown]]),
- The [[https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf][R Markdown Reference guide]],
- [[https://github.com/rstudio/cheatsheets/raw/master/data-visualization-2.1.pdf][Data visualization with ggplot2]],
- [[https://github.com/rstudio/cheatsheets/raw/master/data-transformation.pdf][Data transformation with dplyr]]
In case it helps, here are some (sometimes outdated) French versions
of these documents:
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/rstudio-IDE-cheatsheet.pdf][L'IDE RStudio]]
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/ggplot2-french-cheatsheet.pdf][Visualisation de données avec ggplot2]]
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/data-wrangling-french.pdf][Transformation de données avec dplyr]]
- [[https://www.fun-mooc.fr/c4x/UPSUD/42001S02/asset/RMarkdown.pdf][Un court document sur R Markdown]]
# -*- mode: org -*-
#+TITLE: Rstudio : installation et documentation
#+DATE: June, 2018
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
* Table des matières :TOC:
- [[#installer-rstudio][Installer RStudio]]
- [[#linux-debian-ubuntu][Linux (debian, ubuntu)]]
- [[#mac-osx-and-windows][Mac OSX and Windows]]
- [[#documentation-rstudio][Documentation RStudio]]
* Installer RStudio
** Linux (debian, ubuntu)
Nous ne fournissons ici que des instructions pour les distributions
basées sur Debian. N’hésitez pas à contribuer à ce document en
fournissant des informations à jour sur les autres distributions
(RedHat, Fedora, par exemple).
Aujourd'hui, les versions stables des distributions les plus courantes
fournissent des versions assez récentes de R :
- Debian (stretch) est livré avec [[https://packages.debian.org/stretch/r-base][R 3.3.3-1]], [[https://packages.debian.org/stretch/r-cran-knitr][knitr 1.15.1]], et [[https://packages.debian.org/stretch/r-cran-ggplot2][ggplot 2.2.1]]
- Ubuntu (bionic 18.04) est livré avec [[https://packages.ubuntu.com/bionic/r-base][R 3.4.4]], [[https://packages.ubuntu.com/bionic/r-cran-knitr][knitr 1.17]], et [[https://packages.ubuntu.com/bionic/r-cran-ggplot2][ggplot 2.2.1]]
- Ubuntu (artful 17.04) est livré avec [[https://packages.ubuntu.com/artful/r-base][R 3.4.2]], [[https://packages.ubuntu.com/artful/r-cran-knitr][knitr 1.15]], et [[https://packages.ubuntu.com/artful/r-cran-ggplot2][ggplot 2.2.1]]
Si votre distribution est plus ancienne, c'est peut-être l'occasion de
la mettre à jour...
*** Installer R
Pour commencer, vous devez installer le langage R et quelques packages
en exécutant (à la racine) :
#+BEGIN_SRC shell
apt-get update ; sudo apt-get install r-base r-cran-knitr r-cran-ggplot2
#+END_SRC
Si l'installation de =r-cran-knitr= ou =r-cran-gplot2= échoue, vous pouvez
également installer ces packages manuellement en exécutant les
commandes suivantes sous R (ou RStudio) :
#+BEGIN_SRC R
install.packages("knitr")
install.packages("ggplot2")
#+END_SRC
Si vous envisagez d'exporter des documents pdf avec LaTeX, il faudra
probablement aussi exécuter (à la racine) :
#+begin_src shell :results output :exports both
apt-get update ; apt-get install texlive-base
#+end_src
*** Installer RStudio
RStudio n’est malheureusement pas intégré à Debian. Le plus simple est
de télécharger le paquet Debian correspondant sur le [[https://www.rstudio.com/products/rstudio/download/#download][site RStudio]],
puis de l’installer manuellement (vous devrez peut-être adapter le
numéro de version) :
#+BEGIN_SRC shell
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
#+END_SRC
** Mac OSX and Windows
- Installer R et Python en suivant les instruction dans une [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/19c2b1de7766484bae73f3ab133463c6][ressource spécifique]].
- Télécharger et installer RStudio depuis le [[https://www.rstudio.com/products/rstudio/download/#download][site RStudio]] en
choisissant le bon système d'exploitation.
- Télécharger et installer MiKTeX depuis le [[https://miktex.org/download][site MiKTeX]] en choisissant le bon
système d'exploitation. Vous serez amené à installer différents
packages lors du premier export pdf.
- Ouvrir RStudio et exécuter les commandes suivantes dans la console pour
installer =knitr= et =ggplot2=
#+BEGIN_SRC R
install.packages("knitr", dep=TRUE)
install.packages("ggplot2", dep=TRUE)
#+END_SRC
* Documentation RStudio
L’équipe de RStudio a créé différents matériels et tutoriels très bien
faits. Nous vous recommandons de consulter les [[https://www.rstudio.com/resources/cheatsheets/][fiches mémo]]. En
particulier, vous pourriez être intéressés par celles-ci :
- [[https://github.com/rstudio/cheatsheets/raw/master/rstudio-ide.pdf][RStudio IDE]],
- [[https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf][R Markdown]] (here is also a [[https://rmarkdown.rstudio.com/][nice step-by-step presentation of Rmarkdown]]),
- The [[https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf][R Markdown Reference guide]],
- [[https://github.com/rstudio/cheatsheets/raw/master/data-visualization-2.1.pdf][Data visualization with ggplot2]],
- [[https://github.com/rstudio/cheatsheets/raw/master/data-transformation.pdf][Data transformation with dplyr]]
Voici aussi les versions françaises de certains documents mais elles
ne sont pas toujours à jour :
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/rstudio-IDE-cheatsheet.pdf][IDE RStudio]]
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/ggplot2-french-cheatsheet.pdf][Visualisation de données avec ggplot2]]
- [[https://github.com/rstudio/cheatsheets/raw/master/translations/french/data-wrangling-french.pdf][Transformation de données avec dplyr]]
- [[https://www.fun-mooc.fr/c4x/UPSUD/42001S02/asset/RMarkdown.pdf][Un court document sur R Markdown]]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment