Commit 16067800 authored by Laurence Farhi's avatar Laurence Farhi

Merge branch 'master' of gitlab.inria.fr:learninglab/mooc-rr/mooc-rr-ressources

parents 58091e31 97e5bb67
...@@ -279,3 +279,5 @@ The whole purpose of all these recording systems is to preserve values. They sho ...@@ -279,3 +279,5 @@ The whole purpose of all these recording systems is to preserve values. They sho
laboratory and should be adequate but not overelaborate. If too much is demanded of human nature, the system will break down. laboratory and should be adequate but not overelaborate. If too much is demanded of human nature, the system will break down.
#+END_QUOTE #+END_QUOTE
** Additional links
A student of the course pointed to us a very interesting ressource on laboratory notebooks: [[https://colinpurrington.com/tips/lab-notebooks]].
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#+STARTUP: indent #+STARTUP: indent
* Table of contents :TOC: * Table of contents :TOC:
- [[Version control with GitLab and Git]] - [[#version-control-with-gitlab-and-git-in-the-Reproducible-research-mooc][Version control with GitLab and Git]]
- [[Version control with LibreOffice or DokuWiki]] - [[#version-control-with-libreoffice-or-dokuwiki][Version control with LibreOffice or DokuWiki]]
* Version control with GitLab and Git in the "Reproducible research" MOOC * Version control with GitLab and Git in the "Reproducible research" MOOC
We have created a GitLab server especially for this MOOC so that you can smoothly learn how to implement version control. We have created a GitLab server especially for this MOOC so that you can smoothly learn how to implement version control.
......
...@@ -158,7 +158,8 @@ instructions given in this section may help. ...@@ -158,7 +158,8 @@ instructions given in this section may help.
Emacs comes with a very basic default configuration, so almost Emacs comes with a very basic default configuration, so almost
everyone wants to personalize it. Given the flexibility of Emacs, a everyone wants to personalize it. Given the flexibility of Emacs, a
configuration can become quite complex and in fact include what would configuration can become quite complex and in fact include what would
otherwise be considered complete software packages. In the context of otherwise be considered complete software packages (see for example
these Emacs Starter Kits [[https://kieranhealy.org/resources/emacs-starter-kit/][here]] or [[https://www.emacswiki.org/emacs/StarterKits][here]]). In the context of
this MOOC, we propose a relatively minimalist configuration oriented this MOOC, we propose a relatively minimalist configuration oriented
towards "/reproducible research/" with Org-Mode. If you are new to towards "/reproducible research/" with Org-Mode. If you are new to
Emacs, we strongly recommended that you use it with as little Emacs, we strongly recommended that you use it with as little
......
...@@ -34,7 +34,7 @@ regarder la vidéo [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+sessi ...@@ -34,7 +34,7 @@ regarder la vidéo [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+sessi
- [[#étape-6--ouvrez-et-commencez-à-utiliser--avec-votre-journal][Étape 6 : Ouvrez et commencez à utiliser avec votre journal]] - [[#étape-6--ouvrez-et-commencez-à-utiliser--avec-votre-journal][Étape 6 : Ouvrez et commencez à utiliser avec votre journal]]
- [[#un-modèle-darticle-réplicable][Un modèle d'article réplicable]] - [[#un-modèle-darticle-réplicable][Un modèle d'article réplicable]]
- [[#emacs-trucs-et-astuces][Emacs trucs et astuces]] - [[#emacs-trucs-et-astuces][Emacs trucs et astuces]]
- [[#pense-bête][Pense-bête]] - [[#pense-bêtes][Pense-bêtes]]
- [[#tutoriels-vidéo][Tutoriels vidéo]] - [[#tutoriels-vidéo][Tutoriels vidéo]]
- [[#paquets-emacs-utiles-supplémentaires][Paquets emacs utiles supplémentaires]] - [[#paquets-emacs-utiles-supplémentaires][Paquets emacs utiles supplémentaires]]
- [[#autres-ressources][Autres ressources]] - [[#autres-ressources][Autres ressources]]
...@@ -131,7 +131,7 @@ expliqué [[http://sametmax.com/ajouter-un-chemin-a-la-variable-denvironnement-p ...@@ -131,7 +131,7 @@ expliqué [[http://sametmax.com/ajouter-un-chemin-a-la-variable-denvironnement-p
*** Installation et configuration de Matplotlib (bibliothèque graphique python) *** Installation et configuration de Matplotlib (bibliothèque graphique python)
Ouvrez une console DOS et tapez la commande suivante : Ouvrez une console DOS et tapez la commande suivante :
#+begin_src shell :results output :exports both #+begin_src shell :results output :exports both
python -m pip install install -U matplotlib python -m pip install -U matplotlib
#+end_src #+end_src
[[file:emacs_orgmode_images/install_matplotlib.png]] [[file:emacs_orgmode_images/install_matplotlib.png]]
...@@ -155,7 +155,8 @@ Cette section est illustrée dans une [[https://www.fun-mooc.fr/courses/course-v ...@@ -155,7 +155,8 @@ Cette section est illustrée dans une [[https://www.fun-mooc.fr/courses/course-v
Emacs s'installe avec une configuration par défaut très basique que Emacs s'installe avec une configuration par défaut très basique que
chacun va donc vouloir personnaliser. Compte tenu de la flexibilité chacun va donc vouloir personnaliser. Compte tenu de la flexibilité
d'Emacs, sa configuration peut vite devenir assez complexe et pourrait d'Emacs, sa configuration peut vite devenir assez complexe et pourrait
même faire l'objet d'un paquet à part entière. Dans le contexte de ce même faire l'objet d'un paquet à part entière (voir par exemple les
différents Emacs Starter Kits [[https://kieranhealy.org/resources/emacs-starter-kit/][ici]] ou [[https://www.emacswiki.org/emacs/StarterKits][ici]]). Dans le contexte de ce
MOOC, nous vous proposons une configuration relativement minimaliste MOOC, nous vous proposons une configuration relativement minimaliste
orientée "/recherche reproductible/" avec Org-Mode. Si vous êtes peu orientée "/recherche reproductible/" avec Org-Mode. Si vous êtes peu
familier d'Emacs, nous vous recommandons fortement de l'utiliser et de la modifier le moins possible. Il vous suffira de suivre familier d'Emacs, nous vous recommandons fortement de l'utiliser et de la modifier le moins possible. Il vous suffira de suivre
......
...@@ -23,6 +23,7 @@ jupyter notebook ...@@ -23,6 +23,7 @@ jupyter notebook
- [[#making-sure-jupyter-allows-you-to-use-r][Making sure Jupyter allows you to use R]] - [[#making-sure-jupyter-allows-you-to-use-r][Making sure Jupyter allows you to use R]]
- [[#latex-for-pdf-export][LaTeX for PDF export]] - [[#latex-for-pdf-export][LaTeX for PDF export]]
- [[#additional-tips][Additional tips]] - [[#additional-tips][Additional tips]]
- [[#interacting-with-gitlab-and-git][Interacting with GitLab and Git]]
* Jupyter tips and tricks * Jupyter tips and tricks
The following [[https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/][webpage]] lists several Jupyter tricks (in particular, it The following [[https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/][webpage]] lists several Jupyter tricks (in particular, it
...@@ -344,14 +345,17 @@ Here are a few extensions that can ease your life: ...@@ -344,14 +345,17 @@ Here are a few extensions that can ease your life:
#+END_CENTER #+END_CENTER
NB: In the first edition of the MOOC some people had issues making NB: In the first edition of the MOOC some people had issues making
it work under Windows. it work under Windows.
*** • Interacting with GitLab and GitHub ** • Interacting with GitLab and git
To ease your experience, we added pull/push buttons that allow To ease your experience, we added pull/push buttons that allow
you to commit and sync with GitLab. This development was specific to you to commit and sync with GitLab. This development was specific to
the MOOC but inspired from a previous [[https://github.com/Lab41/sunny-side-up][proof of concept]]. We have the MOOC but inspired from a previous [[https://github.com/Lab41/sunny-side-up][proof of concept]]. We have
recently discovered that someone else developed about at the same time recently discovered that someone else developed about at the same time
a [[https://github.com/sat28/githubcommit][rather generic version of this Jupyter plugin]]. Otherwise, remember a [[https://github.com/sat28/githubcommit][rather generic version of this Jupyter plugin]]. Otherwise, remember
that it is very easy to insert a shell cell in Jupyter in which you that it is very easy to insert a shell cell in Jupyter in which you
can easily issue git commands. This is how we work most of the time. can easily issue git commands. This is how we work most of the time. If you choose this solution, you will have to configure Git on your
computer. To do this, you can follow the video
[[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/7508aece244548349424dfd61ee3ba85][Configure git for Gitlab]] and read the document
[[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/gitlab.org][Git and GitLab]].
This being said, you may have noticed that Jupyter keeps a perfect This being said, you may have noticed that Jupyter keeps a perfect
track of the sequence in which cells have been run by updating the track of the sequence in which cells have been run by updating the
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
- [[#sassurer-que-jupyter-vous-permet-dutiliser-r][S'assurer que Jupyter vous permet d'utiliser R]] - [[#sassurer-que-jupyter-vous-permet-dutiliser-r][S'assurer que Jupyter vous permet d'utiliser R]]
- [[#latex-pour-la-génération-de-pdf][LaTeX pour la génération de PDF]] - [[#latex-pour-la-génération-de-pdf][LaTeX pour la génération de PDF]]
- [[#conseils-additionnels][Conseils additionnels]] - [[#conseils-additionnels][Conseils additionnels]]
- [[#interaction-avec-gitlab-et-git][Interaction avec GitLab et git]]
* Jupyter : Trucs et astuces * Jupyter : Trucs et astuces
Cette [[https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/][page web]] (en anglais) recense un certain nombre d'astuces Cette [[https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/][page web]] (en anglais) recense un certain nombre d'astuces
...@@ -381,7 +382,7 @@ vie : ...@@ -381,7 +382,7 @@ vie :
N.B. : Dans la première édition de ce MOOC, certains participants nous N.B. : Dans la première édition de ce MOOC, certains participants nous
ont rapporté avoir eu des difficultés à faire fonctionner cette ont rapporté avoir eu des difficultés à faire fonctionner cette
extension sous Windows. extension sous Windows.
*** • Interaction avec GitLab et GitHub ** • Interaction avec GitLab et git
Pour rendre vous simplifier la vie, nous avons rajouté des boutons Pour rendre vous simplifier la vie, nous avons rajouté des boutons
=pull/push= dans Jupyter qui vous permettent de synchroniser vos =pull/push= dans Jupyter qui vous permettent de synchroniser vos
modifications avec GitLab. Ce développement spécifique pour ce MOOC modifications avec GitLab. Ce développement spécifique pour ce MOOC
...@@ -393,7 +394,10 @@ intéresse, c'est donc une piste intéressante à explorer. Sinon, ...@@ -393,7 +394,10 @@ intéresse, c'est donc une piste intéressante à explorer. Sinon,
souvenez-vous qu'il est très simple d'insérer une cellule shell dans souvenez-vous qu'il est très simple d'insérer une cellule shell dans
Jupyter et vous pouvez facilement y insérer des commandes Jupyter et vous pouvez facilement y insérer des commandes
Git. C'est la façon dont nous travaillons en pratique la majorité du Git. C'est la façon dont nous travaillons en pratique la majorité du
temps. temps. Si vous optez pour cette solution, il vous faudra 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.
Ceci étant dit, vous avez certainement remarqué que Jupyter conserve Ceci étant dit, vous avez certainement remarqué que Jupyter conserve
une trace parfaite de l'ordre dans lequel les cellules ont été une trace parfaite de l'ordre dans lequel les cellules ont été
......
...@@ -227,51 +227,64 @@ Entered on %U ...@@ -227,51 +227,64 @@ Entered on %U
)) ))
(setq org-src-preserve-indentation t) (setq org-src-preserve-indentation t)
(require 'org-tempo nil t) (setq rrmooc/new-org-templates (version<= "9.2" (org-version)))
(when rrmooc/new-org-templates
(require 'org-tempo))
(add-to-list 'org-structure-template-alist (require 'subr-x)
'("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")) (defun rrmooc/add-org-template (old-style-template)
(add-to-list 'org-structure-template-alist
(if rrmooc/new-org-templates
(cons
(first old-style-template)
(string-trim-right (substring (second old-style-template) 8 -9)))
old-style-template)))
(unless rrmooc/new-org-templates
;; this template is predefined in the new templating system
(rrmooc/add-org-template
'("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("m" "#+begin_src emacs-lisp :tangle init.el\n\n#+end_src" "<src lang=\"emacs-lisp\">\n\n</src>")) '("m" "#+begin_src emacs-lisp\n\n#+end_src" "<src lang=\"emacs-lisp\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("r" "#+begin_src R :results output :session *R* :exports both\n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("r" "#+begin_src R :results output :session *R* :exports both\n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("R" "#+begin_src R :results output graphics :file (org-babel-temp-file \"figure\" \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("R" "#+begin_src R :results output graphics :file (org-babel-temp-file \"figure\" \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("RR" "#+begin_src R :results output graphics :file (org-babel-temp-file (concat (file-name-directory (or load-file-name buffer-file-name)) \"figure-\") \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("RR" "#+begin_src R :results output graphics :file (org-babel-temp-file (concat (file-name-directory (or load-file-name buffer-file-name)) \"figure-\") \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("p" "#+begin_src python :results output :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("p" "#+begin_src python :results output :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("P" "#+begin_src python :results output :session :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("P" "#+begin_src python :results output :session :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("PP" "#+begin_src python :results file :session :var matplot_lib_filename=(org-babel-temp-file \"figure\" \".png\") :exports both\nimport matplotlib.pyplot as plt\n\nimport numpy\nx=numpy.linspace(-15,15)\nplt.figure(figsize=(10,5))\nplt.plot(x,numpy.cos(x)/x)\nplt.tight_layout()\n\nplt.savefig(matplot_lib_filename)\nmatplot_lib_filename\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("PP" "#+begin_src python :results file :session :var matplot_lib_filename=(org-babel-temp-file \"figure\" \".png\") :exports both\nimport matplotlib.pyplot as plt\n\nimport numpy\nx=numpy.linspace(-15,15)\nplt.figure(figsize=(10,5))\nplt.plot(x,numpy.cos(x)/x)\nplt.tight_layout()\n\nplt.savefig(matplot_lib_filename)\nmatplot_lib_filename\n#+end_src" "<src lang=\"python\">\n\n</src>"))
(if (memq system-type '(windows-nt ms-dos)) (if (memq system-type '(windows-nt ms-dos))
;; Non-session shell execution does not seem to work under Windows, so we use ;; Non-session shell execution does not seem to work under Windows, so we use
;; a named session just like for B. ;; a named session just like for B.
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>")) '("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))) '("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>")))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("B" "#+begin_src shell :session *shell* :results output :exports both \n\n#+end_src" "<src lang=\"sh\">\n\n</src>")) '("B" "#+begin_src shell :session *shell* :results output :exports both \n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("g" "#+begin_src dot :results output graphics :file \"/tmp/graph.pdf\" :exports both '("g" "#+begin_src dot :results output graphics :file \"/tmp/graph.pdf\" :exports both
digraph G { digraph G {
node [color=black,fillcolor=white,shape=rectangle,style=filled,fontname=\"Helvetica\"]; node [color=black,fillcolor=white,shape=rectangle,style=filled,fontname=\"Helvetica\"];
A[label=\"A\"] A[label=\"A\"]
B[label=\"B\"] B[label=\"B\"]
A->B A->B
}\n#+end_src" "<src lang=\"dot\">\n\n</src>")) }\n#+end_src" "<src lang=\"dot\">\n\n</src>"))
(global-set-key (kbd "C-c S-t") 'org-babel-execute-subtree) (global-set-key (kbd "C-c S-t") 'org-babel-execute-subtree)
......
...@@ -83,7 +83,7 @@ document, simply =M-x org-babel-tangle=. ...@@ -83,7 +83,7 @@ document, simply =M-x org-babel-tangle=.
("melpa-stable" . 10))) ("melpa-stable" . 10)))
#+END_SRC #+END_SRC
* Install missing packages * Install missing packages
#+begin_src emacs-lisp #+begin_src emacs-lisp :tangle init.el
(dolist (pkg '(ess (dolist (pkg '(ess
auctex auctex
htmlize htmlize
...@@ -92,7 +92,7 @@ document, simply =M-x org-babel-tangle=. ...@@ -92,7 +92,7 @@ document, simply =M-x org-babel-tangle=.
(package-install pkg))) (package-install pkg)))
#+end_src #+end_src
* Import environment variables * Import environment variables
#+begin_src emacs-lisp #+begin_src emacs-lisp :tangle init.el
(exec-path-from-shell-initialize) (exec-path-from-shell-initialize)
(exec-path-from-shell-copy-env "PYTHONPATH") (exec-path-from-shell-copy-env "PYTHONPATH")
#+end_src #+end_src
...@@ -366,32 +366,47 @@ Additional shortcuts for navigating through org-mode documents: ...@@ -366,32 +366,47 @@ Additional shortcuts for navigating through org-mode documents:
** Adding source code blocks: :LUKA: ** Adding source code blocks: :LUKA:
*** Enable the old template system with Orgmode 9.2 and later *** Enable the old template system with Orgmode 9.2 and later
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(require 'org-tempo nil t) (setq rrmooc/new-org-templates (version<= "9.2" (org-version)))
(when rrmooc/new-org-templates
(require 'org-tempo))
#+end_src
*** Template definitions that work with the old and new templating systems
#+begin_src emacs-lisp :tangle init.el
(require 'subr-x)
(defun rrmooc/add-org-template (old-style-template)
(add-to-list 'org-structure-template-alist
(if rrmooc/new-org-templates
(cons
(first old-style-template)
(string-trim-right (substring (second old-style-template) 8 -9)))
old-style-template)))
#+end_src #+end_src
*** With capital letters: *** With capital letters:
To use this type <s and then TAB To use this type <s and then TAB
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (unless rrmooc/new-org-templates
'("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")) ;; this template is predefined in the new templating system
(rrmooc/add-org-template
'("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")))
#+end_src #+end_src
*** Emacs-elisp code: *** Emacs-elisp code:
To use this type <m and then TAB To use this type <m and then TAB
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("m" "#+begin_src emacs-lisp :tangle init.el\n\n#+end_src" "<src lang=\"emacs-lisp\">\n\n</src>")) '("m" "#+begin_src emacs-lisp\n\n#+end_src" "<src lang=\"emacs-lisp\">\n\n</src>"))
#+end_src #+end_src
*** R code: *** R code:
To use this type <r and then TAB. This creates an R block for textual output. To use this type <r and then TAB. This creates an R block for textual output.
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("r" "#+begin_src R :results output :session *R* :exports both\n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("r" "#+begin_src R :results output :session *R* :exports both\n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
#+end_src #+end_src
To use this type <R and then TAB. This creates an R block for graphics To use this type <R and then TAB. This creates an R block for graphics
that are stored in the =/tmp/=. that are stored in the =/tmp/=.
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("R" "#+begin_src R :results output graphics :file (org-babel-temp-file \"figure\" \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("R" "#+begin_src R :results output graphics :file (org-babel-temp-file \"figure\" \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
#+end_src #+end_src
...@@ -399,23 +414,23 @@ To use this type <RR and then TAB. This creates an R block for ...@@ -399,23 +414,23 @@ To use this type <RR and then TAB. This creates an R block for
graphics that are stored in the directory of the current file. graphics that are stored in the directory of the current file.
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("RR" "#+begin_src R :results output graphics :file (org-babel-temp-file (concat (file-name-directory (or load-file-name buffer-file-name)) \"figure-\") \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>")) '("RR" "#+begin_src R :results output graphics :file (org-babel-temp-file (concat (file-name-directory (or load-file-name buffer-file-name)) \"figure-\") \".png\") :exports both :width 600 :height 400 :session *R* \n\n#+end_src" "<src lang=\"R\">\n\n</src>"))
#+end_src #+end_src
*** Python code *** Python code
To use this type <p and then TAB To use this type <p and then TAB
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("p" "#+begin_src python :results output :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("p" "#+begin_src python :results output :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>"))
#+end_src #+end_src
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("P" "#+begin_src python :results output :session :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("P" "#+begin_src python :results output :session :exports both\n\n#+end_src" "<src lang=\"python\">\n\n</src>"))
#+end_src #+end_src
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("PP" "#+begin_src python :results file :session :var matplot_lib_filename=(org-babel-temp-file \"figure\" \".png\") :exports both\nimport matplotlib.pyplot as plt\n\nimport numpy\nx=numpy.linspace(-15,15)\nplt.figure(figsize=(10,5))\nplt.plot(x,numpy.cos(x)/x)\nplt.tight_layout()\n\nplt.savefig(matplot_lib_filename)\nmatplot_lib_filename\n#+end_src" "<src lang=\"python\">\n\n</src>")) '("PP" "#+begin_src python :results file :session :var matplot_lib_filename=(org-babel-temp-file \"figure\" \".png\") :exports both\nimport matplotlib.pyplot as plt\n\nimport numpy\nx=numpy.linspace(-15,15)\nplt.figure(figsize=(10,5))\nplt.plot(x,numpy.cos(x)/x)\nplt.tight_layout()\n\nplt.savefig(matplot_lib_filename)\nmatplot_lib_filename\n#+end_src" "<src lang=\"python\">\n\n</src>"))
#+end_src #+end_src
*** Bash "sh" code: *** Bash "sh" code:
...@@ -424,28 +439,28 @@ To use this type <b and then TAB ...@@ -424,28 +439,28 @@ To use this type <b and then TAB
(if (memq system-type '(windows-nt ms-dos)) (if (memq system-type '(windows-nt ms-dos))
;; Non-session shell execution does not seem to work under Windows, so we use ;; Non-session shell execution does not seem to work under Windows, so we use
;; a named session just like for B. ;; a named session just like for B.
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>")) '("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))) '("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "<src lang=\"sh\">\n\n</src>")))
#+end_src #+end_src
To use this type <B and then TAB. This comes with a session argument To use this type <B and then TAB. This comes with a session argument
(e.g., in case you want to keep ssh connexions open). (e.g., in case you want to keep ssh connexions open).
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("B" "#+begin_src shell :session *shell* :results output :exports both \n\n#+end_src" "<src lang=\"sh\">\n\n</src>")) '("B" "#+begin_src shell :session *shell* :results output :exports both \n\n#+end_src" "<src lang=\"sh\">\n\n</src>"))
#+end_src #+end_src
*** Graphviz *** Graphviz
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
(add-to-list 'org-structure-template-alist (rrmooc/add-org-template
'("g" "#+begin_src dot :results output graphics :file \"/tmp/graph.pdf\" :exports both '("g" "#+begin_src dot :results output graphics :file \"/tmp/graph.pdf\" :exports both
digraph G { digraph G {
node [color=black,fillcolor=white,shape=rectangle,style=filled,fontname=\"Helvetica\"]; node [color=black,fillcolor=white,shape=rectangle,style=filled,fontname=\"Helvetica\"];
A[label=\"A\"] A[label=\"A\"]
B[label=\"B\"] B[label=\"B\"]
A->B A->B
}\n#+end_src" "<src lang=\"dot\">\n\n</src>")) }\n#+end_src" "<src lang=\"dot\">\n\n</src>"))
#+end_src #+end_src
** Evaluating whole subtree: :LUKA: ** Evaluating whole subtree: :LUKA:
#+begin_src emacs-lisp :tangle init.el #+begin_src emacs-lisp :tangle init.el
......
...@@ -89,8 +89,8 @@ of these documents: ...@@ -89,8 +89,8 @@ of these documents:
* Using Git from RStudio * Using Git from RStudio
If you have never used git with RStudio, *we strongly advise that you 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"/ 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"/
in French). Before proceeding, make sure you also have followed the ). 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]]* (in French). *[[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 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 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
......
...@@ -93,11 +93,11 @@ ne sont pas toujours à jour : ...@@ -93,11 +93,11 @@ ne sont pas toujours à jour :
* Utiliser Git avec RStudio * Utiliser Git avec RStudio
La première chose à faire est de configurer Git sur votre La première chose à faire est de configurer Git sur votre
ordinateur. Pour ce faire, vous pouvez suivre la vidéo 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]] (en français) et le document [[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 (en français). [[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 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]] (en français) dont les étapes 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. 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 /(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
......
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