Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • LBMC/hub/formations/R_basis
  • can/R_basis
2 results
Select Git revision
Show changes
Commits on Source (40)
Showing
with 1543 additions and 110 deletions
......@@ -21,3 +21,7 @@ forms/*.csv
forms/2021/
local/*
public/*
/.quarto/
/_book/
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html
pages:
stage: deploy
image: carinerey/r_for_beginners
image: rocker/tidyverse
script:
- make
- quarto -v
- |
apt update && apt install -y libxt6 cargo
#session 1
Rscript -e "install.packages('rvest')"
#session 3
Rscript -e "install.packages('gganimate')"
Rscript -e "install.packages('gifski')"
Rscript -e "install.packages('openxlsx')"
#session 4
Rscript -e "install.packages(c('ghibli', 'nycflights13','viridis','ggrepel'))"
- |
quarto render
mkdir public
cp -r _book/* public/
interruptible: true
artifacts:
paths:
- public
......
......@@ -6,13 +6,27 @@ Course link : https://can.gitbiopages.ens-lyon.fr/R_basis/
### Trainers
- Nicolas Fontrodona
- Christophe Arpin
- Laurent Gilquin
- Ghislain Durif (IFB)
- Antoine Corbin
- Omran Allatif
- Carine Rey (IFB)
- **Monday**
- Nicolas Fontrodona (IFB)
- Laurent Gilquin
- Audrey Lapendry
- **Tuesday **
- Christophe Arpin (IFB)
- Ghislain Durif (IFB)
- **Wednesday**
- Antoine Corbin (IFB)
- Anissa Guillemin
- Noemi Rousseaux
- **Friday**
- Omran Allatif (IFB)
- Carine Rey (IFB)
## 2021
......
project:
type: book
book:
title: "R for beginners"
author:
- "Laurent Modolo"
- "Carine Rey"
- "Helene Polveche"
- "Ghislain Durif"
- "Nicolas Fontrodona"
- "Romain Bulteau"
date: "2023-10-09"
chapters:
- index.qmd
- session_1/session_1.Rmd
- session_2/session_2.Rmd
- session_3/session_3.Rmd
- session_4/session_4.Rmd
- session_5/session_5.Rmd
- session_6/session_6.Rmd
- session_7/session_7.Rmd
- session_8/session_8.Rmd
body-footer: "License: FIXME.<br>Made with [Quarto](https://quarto.org/)."
navbar:
search: true
right:
- icon: git
href: https://gitbio.ens-lyon.fr/can/R_basis
text: Sources
# bibliography: references.bib
format:
html:
theme:
light: flatly
dark: darkly
execute:
cache: true
\ No newline at end of file
---
title: # R for beginners
---
# R for beginners (2022)
1. [Introduction to R and RStudio](./session_1.html)
2. [Introduction to Tidyverse](./session_2.html)
3. [Transformations with ggplot2](./session_3.html)
4. [Data transformation](./session_4.html)
5. [Pipping and grouping](./session_5.html)
6. [Tidydata](./session_6.html)
7. [String & RegExp](./session_7.html)
8. [Factors](./session_8.html)
# R for beginners {.unnumbered}
1. [Introduction to R and RStudio](session_1/session_1.html)
2. [Introduction to Tidyverse](session_2/session_2.html)
3. [Transformations with ggplot2](session_3/session_3.html)
4. [Data transformation](session_4/session_4.html)
5. [Pipping and grouping](session_5/session_5.html)
6. [Tidydata](session_6/session_6.html)
7. [String & RegExp](session_7/session_7.html)
8. [Factors](session_8/session_8.html)
(2018-2013)
File moved
$webform = array (
'nid' => '778888',
'next_serial' => '1',
'confirmation' => '',
'confirmation_format' => 'wysiwyg_user',
'redirect_url' => '<none>',
'status' => '1',
'block' => '0',
'allow_draft' => '0',
'auto_save' => '0',
'submit_notice' => '1',
'confidential' => '0',
'submit_text' => '',
'submit_limit' => '1',
'submit_interval' => '-1',
'total_submit_limit' => '-1',
'total_submit_interval' => '-1',
'progressbar_bar' => '0',
'progressbar_page_number' => '0',
'progressbar_percent' => '0',
'progressbar_pagebreak_labels' => '1',
'progressbar_include_confirmation' => '1',
'progressbar_label_first' => 'Inscription / Registration',
'progressbar_label_confirmation' => 'Terminé',
'preview' => '0',
'preview_next_button_label' => '',
'preview_prev_button_label' => '',
'preview_title' => '',
'preview_message' => '',
'preview_message_format' => 'wysiwyg_user',
'preview_excluded_components' =>
array (
),
'confirm_email_request_lifetime' => NULL,
'confirm_email_delete_submissions' => '0',
'record_exists' => true,
'roles' =>
array (
0 => '1',
1 => '2',
),
'emails' =>
array (
),
'components' =>
array (
15 =>
array (
'nid' => 778888,
'cid' => '15',
'pid' => '0',
'form_key' => 'new_1663580649768',
'name' => 'Prénom / Name',
'type' => 'textfield',
'value' => '',
'extra' =>
array (
'width' => '',
'maxlength' => '',
'minlength' => '',
'field_prefix' => '',
'field_suffix' => '',
'disabled' => 0,
'unique' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'Dupont',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '1',
'page_num' => 1,
),
14 =>
array (
'nid' => 778888,
'cid' => '14',
'pid' => '0',
'form_key' => 'new_1663580608320',
'name' => 'Nom / Surname',
'type' => 'textfield',
'value' => '',
'extra' =>
array (
'width' => '',
'maxlength' => '',
'minlength' => '',
'field_prefix' => '',
'field_suffix' => '',
'disabled' => 0,
'unique' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'John',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '2',
'page_num' => 1,
),
1 =>
array (
'nid' => 778888,
'cid' => '1',
'pid' => '0',
'form_key' => 'new_1661852344800',
'name' => 'adresse e-mail / e-mail address',
'type' => 'email',
'value' => '@ens-lyon.fr (ou @inserm.fr, @chu-lyon.fr)',
'extra' =>
array (
'multiple' => 0,
'format' => 'short',
'width' => '',
'unique' => 1,
'disabled' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => '',
'attributes' =>
array (
),
'private' => 0,
'analysis' => true,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '3',
'page_num' => 1,
),
3 =>
array (
'nid' => 778888,
'cid' => '3',
'pid' => '0',
'form_key' => 'new_1661852536156',
'name' => 'Laboratoire / Laboratory',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|CIRI - Centre International de Recherche en Infectiologie
2|IGFL - Institut de Génomique Fonctionnelle de lyon
3|LBMC - Laboratoire de Biologie et modelisation de la Cellule
RDP - Laboratoire de Reproduction et Développement des Plantes|RDP - Laboratoire de Reproduction et Développement des Plantes
MMSB - MOlecular microbiology and structural biochemistry|MMSB - MOlecular microbiology and structural biochemistry
LBTI - Laboratoire de Biologie Tissulaire et d\'Ingénierie Thérapeutique|LBTI - Laboratoire de Biologie Tissulaire et d\'Ingénierie Thérapeutique
IVPC - Infections Virales et Pathologie Comparée|IVPC - Infections Virales et Pathologie Comparée
IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service UMS3760 CNRS-UCBL - Directeur : Christophe Geourjon L\'IBCP héberge les 2 unités de recherche MMSB et LBTI. L’institut a pour vocation de gérer le bâtiment, les ressources technologiques et une partie du personnel technique partagé par ces 2 unités.|IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service UMS3760 CNRS-UCBL - Directeur : Christophe Geourjon L\'IBCP héberge les 2 unités de recherche MMSB et LBTI. L’institut a pour vocation de gérer le bâtiment, les ressources technologiques et une partie du personnel technique partagé par ces 2 unités.
',
'multiple' => false,
'aslist' => true,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '4',
'page_num' => 1,
),
30 =>
array (
'nid' => 778888,
'cid' => '30',
'pid' => '0',
'form_key' => 'new_1693394806558',
'name' => 'J\'ai un compte @ens-lyon.fr / I have an @ens-lyon.fr account',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Oui / Yes
2|Non / No
',
'multiple' => false,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '5',
'page_num' => 1,
),
31 =>
array (
'nid' => 778888,
'cid' => '31',
'pid' => '0',
'form_key' => 'new_1693394865971',
'name' => 'J\'ai un compte sur le cloud de l\'IFB (Institut Français de Bioinformatique)',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Oui / Yes
2|Non / No
',
'multiple' => false,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '6',
'page_num' => 1,
),
32 =>
array (
'nid' => 778888,
'cid' => '32',
'pid' => '0',
'form_key' => 'new_1693394929998',
'name' => 'Cloud IFB',
'type' => 'markup',
'value' => '<p>Nous utilisons le cloud de l\'IFB (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) pour les travaux pratiques (les stagiaires travailleront depuis un navigateur internet sur une instance Rstudio server hébergé sur le cloud de l\'IFB).</p>
<p><i>We use the IFB cloud (<link href="https://biosphere.france-bioinformatique.fr/">https://biosphere.france-bioinformatique.fr/</link>) for the practicals (trainees work in their web browser on a Rstudio server hosted on IFB cloud).</i></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '7',
'page_num' => 1,
),
12 =>
array (
'nid' => 778888,
'cid' => '12',
'pid' => '0',
'form_key' => 'new_1663579980628',
'name' => 'Choix des créneaux de préférences ? / Preferred slots ?',
'type' => 'grid',
'value' => '',
'extra' =>
array (
'options' => '0|Oui, je suis disponible / Yes, I am available
1|Oui, mais si possible je préférerais un autre créneau / Yes, but I would prefer another slot if possible
3|Non disponible / Not available
',
'questions' => '0|Lundi / Monday 13h-14h30 - salle numérique CBP (ENS de Lyon) - FR
1|Mercredi / Wednesday 11h-12h30 - salle numérique CBP (ENS de Lyon) - FR
3|Jeudi / Thursday 11h-12h30 - salle numérique CBP (ENS de Lyon) - EN
2|Vendredi / Friday 11h-12h30 - salle numérique CBP (ENS de Lyon) - FR
',
'optrand' => 0,
'qrand' => 0,
'unique' => 0,
'title_display' => 'before',
'custom_option_keys' => 0,
'custom_question_keys' => 0,
'sticky' => true,
'description' => '',
'description_above' => false,
'private' => 0,
'analysis' => true,
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '8',
'page_num' => 1,
),
23 =>
array (
'nid' => 778888,
'cid' => '23',
'pid' => '0',
'form_key' => 'new_1693320671454',
'name' => 'Créneaux / Slots',
'type' => 'markup',
'value' => '<p><strong>Attention</strong> aux horaires qui sont différents le lundi.</p>
<p><i><strong>Watch out</strong> for the hours which are different on Mondays</i></p>
<p>Les salles seront reprécisées par la suite.</p>
<p><i>More details about the locations will be given later.</i></p>
<p>Il y a 10 stagiaires par créneaux, et idéalement 2 formateurs ou formatrices.</p>
<p><i>There will be 10 trainees per slot, and ideally 2 trainers.</i></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '9',
'page_num' => 1,
),
26 =>
array (
'nid' => 778888,
'cid' => '26',
'pid' => '0',
'form_key' => 'new_1693321164081',
'name' => 'Langue souhaitée / Preferred language',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Français
2|English
3|Pas de préférence / No preference
',
'multiple' => false,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '10',
'page_num' => 1,
),
21 =>
array (
'nid' => 778888,
'cid' => '21',
'pid' => '0',
'form_key' => 'new_1693319362737',
'name' => 'En vous inscrivant vous vous engagez à animer l\'ensemble de la formation. / By registering, you agree to teach the entire course.',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Oui / Yes
',
'multiple' => true,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1,2',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '12',
'page_num' => 1,
),
24 =>
array (
'nid' => 778888,
'cid' => '24',
'pid' => '0',
'form_key' => 'new_1693320727085',
'name' => 'Nouveau champ "balisage"',
'type' => 'markup',
'value' => '<p>(sauf absence ponctuelle en cas d\'impératif professionnel ou personnel évidemment)</p>
<p><i>(except for one-time absences in case of professional or personal imperative obviously)</i><p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '13',
'page_num' => 1,
),
28 =>
array (
'nid' => 778888,
'cid' => '28',
'pid' => '0',
'form_key' => 'new_1693321289280',
'name' => 'Remarques ou commentaires / Remarks or comments',
'type' => 'textarea',
'value' => '',
'extra' =>
array (
'cols' => '',
'rows' => '',
'title_display' => 'before',
'resizable' => 1,
'disabled' => 0,
'description' => '',
'description_above' => false,
'placeholder' => '',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '0',
'weight' => '14',
'page_num' => 1,
),
),
'conditionals' =>
array (
),
);
$webform = array (
'nid' => '778530',
'next_serial' => '1',
'confirmation' => '',
'confirmation_format' => 'wysiwyg_user',
'redirect_url' => '<none>',
'status' => '1',
'block' => '0',
'allow_draft' => '0',
'auto_save' => '0',
'submit_notice' => '1',
'confidential' => '0',
'submit_text' => '',
'submit_limit' => '1',
'submit_interval' => '-1',
'total_submit_limit' => '-1',
'total_submit_interval' => '-1',
'progressbar_bar' => '0',
'progressbar_page_number' => '0',
'progressbar_percent' => '0',
'progressbar_pagebreak_labels' => '1',
'progressbar_include_confirmation' => '1',
'progressbar_label_first' => 'Inscription / Registration',
'progressbar_label_confirmation' => 'Terminé',
'preview' => '0',
'preview_next_button_label' => '',
'preview_prev_button_label' => '',
'preview_title' => '',
'preview_message' => '',
'preview_message_format' => 'wysiwyg_user',
'preview_excluded_components' =>
array (
),
'confirm_email_request_lifetime' => NULL,
'confirm_email_delete_submissions' => '0',
'record_exists' => true,
'roles' =>
array (
0 => '1',
1 => '2',
),
'emails' =>
array (
),
'components' =>
array (
15 =>
array (
'nid' => 778530,
'cid' => '15',
'pid' => '0',
'form_key' => 'new_1663580649768',
'name' => 'Prénom / Name',
'type' => 'textfield',
'value' => '',
'extra' =>
array (
'width' => '',
'maxlength' => '',
'minlength' => '',
'field_prefix' => '',
'field_suffix' => '',
'disabled' => 0,
'unique' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'Dupont',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '1',
'page_num' => 1,
),
14 =>
array (
'nid' => 778530,
'cid' => '14',
'pid' => '0',
'form_key' => 'new_1663580608320',
'name' => 'Nom / Surname',
'type' => 'textfield',
'value' => '',
'extra' =>
array (
'width' => '',
'maxlength' => '',
'minlength' => '',
'field_prefix' => '',
'field_suffix' => '',
'disabled' => 0,
'unique' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => 'John',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '2',
'page_num' => 1,
),
1 =>
array (
'nid' => 778530,
'cid' => '1',
'pid' => '0',
'form_key' => 'new_1661852344800',
'name' => 'adresse e-mail / e-mail address',
'type' => 'email',
'value' => '@ens-lyon.fr (ou @inserm.fr, @chu-lyon.fr)',
'extra' =>
array (
'multiple' => 0,
'format' => 'short',
'width' => '',
'unique' => 1,
'disabled' => 0,
'title_display' => 'before',
'description' => '',
'description_above' => false,
'placeholder' => '',
'attributes' =>
array (
),
'private' => 0,
'analysis' => true,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '3',
'page_num' => 1,
),
3 =>
array (
'nid' => 778530,
'cid' => '3',
'pid' => '0',
'form_key' => 'new_1661852536156',
'name' => 'Laboratoire / Laboratory',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|CIRI - Centre International de Recherche en Infectiologie
2|IGFL - Institut de Génomique Fonctionnelle de lyon
3|LBMC - Laboratoire de Biologie et modelisation de la Cellule
RDP - Laboratoire de Reproduction et Développement des Plantes|RDP - Laboratoire de Reproduction et Développement des Plantes
MMSB - MOlecular microbiology and structural biochemistry|MMSB - MOlecular microbiology and structural biochemistry
LBTI - Laboratoire de Biologie Tissulaire et d\'Ingénierie Thérapeutique|LBTI - Laboratoire de Biologie Tissulaire et d\'Ingénierie Thérapeutique
IVPC - Infections Virales et Pathologie Comparée|IVPC - Infections Virales et Pathologie Comparée
IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service UMS3760 CNRS-UCBL - Directeur : Christophe Geourjon L\'IBCP héberge les 2 unités de recherche MMSB et LBTI. L’institut a pour vocation de gérer le bâtiment, les ressources technologiques et une partie du personnel technique partagé par ces 2 unités.|IBCP - Institut de Biologie et Chimie des Proteines Unité mixte de service UMS3760 CNRS-UCBL - Directeur : Christophe Geourjon L\'IBCP héberge les 2 unités de recherche MMSB et LBTI. L’institut a pour vocation de gérer le bâtiment, les ressources technologiques et une partie du personnel technique partagé par ces 2 unités.
',
'multiple' => false,
'aslist' => true,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '4',
'page_num' => 1,
),
20 =>
array (
'nid' => 778530,
'cid' => '20',
'pid' => '0',
'form_key' => 'new_1693318963943',
'name' => 'Information sur les prérequis / <i>Information about requirements</i>',
'type' => 'markup',
'value' => '<p><strong>Prérequis</strong> : avoir un compte @ens-lyon.fr (pour accéder aux ordinateurs des salles de TP) ou avoir un ordinateur portable avec accès à internet via Eduroam et un navigateur internet récent (aucune installation spécifique nécessaire, les TPs se font via une plateforme accessible par son navigateur Internet).</p>
<p><i><strong>Requirement</strong>: having an @ens-lyon.fr account (to access computers during the session) or having a laptop with a working eduroam Internet access and a recent web browser (no further installation is required, all practicals will be done via a platform available through the web browser).</i></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '5',
'page_num' => 1,
),
19 =>
array (
'nid' => 778530,
'cid' => '19',
'pid' => '0',
'form_key' => 'new_1693316967281',
'name' => 'Avez-vous ? / Do you have?',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|un compte @ens-lyon.fr ? / an @ens-lyon.fr account?
2|un ordinateur portable avec un accès à Internet par Wifi Eduroam ? / a computer laptop with Eduroam Wifi Internet access
Ni l\'un ni l\'autre / None of the above|Ni l\'un ni l\'autre / None of the above
',
'multiple' => true,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1,2',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '6',
'page_num' => 1,
),
12 =>
array (
'nid' => 778530,
'cid' => '12',
'pid' => '0',
'form_key' => 'new_1663579980628',
'name' => 'Choix des créneaux de préférences ? / Preferred slots ?',
'type' => 'grid',
'value' => '',
'extra' =>
array (
'options' => '0|Oui, je suis disponible / Yes, I am available
1|Oui, mais si possible je préférerais un autre créneau / Yes, but I would prefer another slot if possible
3|Non disponible / Not available
',
'questions' => '0|Lundi / Monday 13h-14h30 - salle numérique CBP (ENS de Lyon) - FR
1|Mercredi / Wednesday 11h-12h30 - salle numérique CBP (ENS de Lyon) - FR
3|Jeudi / Thursday 11h-12h30 - salle numérique CBP (ENS de Lyon) - EN
2|Vendredi / Friday 11h-12h30 - salle numérique CBP (ENS de Lyon) - FR
',
'optrand' => 0,
'qrand' => 0,
'unique' => 0,
'title_display' => 'before',
'custom_option_keys' => 0,
'custom_question_keys' => 0,
'sticky' => true,
'description' => '',
'description_above' => false,
'private' => 0,
'analysis' => true,
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '7',
'page_num' => 1,
),
23 =>
array (
'nid' => 778530,
'cid' => '23',
'pid' => '0',
'form_key' => 'new_1693320671454',
'name' => 'Créneaux / Slots',
'type' => 'markup',
'value' => '<p><strong>Attention</strong> aux horaires qui sont différents le lundi.</p>
<p><i><strong>Watch out</strong> for the hours which are different on Mondays</i></p>
<p>Les salles seront reprécisées par la suite.</p>
<p><i>More details about the locations will be given later.</i></p>
<p>Il y a 10 places par créneaux, nous essaierons de satisfaire toutes les personnes inscrites (la priorité suivra l\'ordre chronologique des inscriptions).</p>
<p><i>There will be 10 places per slot, we will try to satisfy every registered persons (priority will follow chronological registration order).</i></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '8',
'page_num' => 1,
),
26 =>
array (
'nid' => 778530,
'cid' => '26',
'pid' => '0',
'form_key' => 'new_1693321164081',
'name' => 'Langue souhaitée / Preferred language',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Français
2|English
3|Pas de préférence / No preference
',
'multiple' => false,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '9',
'page_num' => 1,
),
17 =>
array (
'nid' => 778530,
'cid' => '17',
'pid' => '0',
'form_key' => 'new_1663582031315',
'name' => 'Information générales / General information',
'type' => 'markup',
'value' => '<h1>IMPORTANT</h1>
<p><ul>
<li><p>Pour la première séance nous fixerons un point de rendez vous pour ceux et celles qui ne connaîtraient pas la localisation des salles.</p>
<p><i>For the first session, if you do not know the room location, we will give you a rendez-vous point.</i></p></li>
<li><p>Il ne sera pas possible de changer de groupes (sauf cas exceptionnel) au cours du semestre car chaque groupe ira à sa vitesse.</p>
<p><i>It will not be possible to switch groups (except in exceptional cases) during the semester because each group will go at its own pace</i><p></li>
</ul></p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '11',
'page_num' => 1,
),
21 =>
array (
'nid' => 778530,
'cid' => '21',
'pid' => '0',
'form_key' => 'new_1693319362737',
'name' => 'En vous inscrivant vous vous engagez à venir sur l\'ensemble de la formation. / By registering, you agree to attend the entire course.',
'type' => 'select',
'value' => '',
'extra' =>
array (
'items' => '1|Oui / Yes
',
'multiple' => true,
'aslist' => false,
'empty_option' => '',
'optrand' => 0,
'other_option' => NULL,
'other_text' => 'Autre...',
'title_display' => 'before',
'description' => '',
'description_above' => false,
'custom_keys' => 0,
'options_source' => '',
'private' => 0,
'analysis' => true,
'value' => '1,2',
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '1',
'weight' => '12',
'page_num' => 1,
),
24 =>
array (
'nid' => 778530,
'cid' => '24',
'pid' => '0',
'form_key' => 'new_1693320727085',
'name' => 'Nouveau champ "balisage"',
'type' => 'markup',
'value' => '<p>(sauf absence ponctuelle en cas d\'impératif professionnel ou personnel évidemment)</p>
<p><i>(except for one-time absences in case of professional or personal imperative obviously)</i><p>',
'extra' =>
array (
'format' => 'wysiwyg_user',
'private' => false,
'display_on' => 'form',
),
'required' => '0',
'weight' => '13',
'page_num' => 1,
),
28 =>
array (
'nid' => 778530,
'cid' => '28',
'pid' => '0',
'form_key' => 'new_1693321289280',
'name' => 'Remarques ou commentaires / Remarks or comments',
'type' => 'textarea',
'value' => '',
'extra' =>
array (
'cols' => '',
'rows' => '',
'title_display' => 'before',
'resizable' => 1,
'disabled' => 0,
'description' => '',
'description_above' => false,
'placeholder' => '',
'attributes' =>
array (
),
'private' => 0,
'analysis' => false,
'css_classes' => '',
'wrapper_classes' => '',
),
'required' => '0',
'weight' => '14',
'page_num' => 1,
),
),
'conditionals' =>
array (
),
);
# IFB cloud group description for R training
## Short name
CAN R 2023
## Full name
R for beginners training
## Website
https://gitbio.ens-lyon.fr/can/R_basis
---
# Detailed description
## Résumé (20 lignes)
Le [Conseil d'Analyse Numérique (CAN)](https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) de l'UAR [SFR BioSciences](https://www.sfr-biosciences.fr) (Lyon) organise une formation **"R pour les débutants"** à destination des membres des laboratoires de biologie affiliés (entre autres ceux hébergés à l'ENS de Lyon), laquelle débutera début octobre.
Cette formation s'étalera sur une quatorzaine de semaines à raison de 1h30 par semaine au semestre d'automne (suivant les demandes, elle aura lieu tous les ans au semestre d'automne).
Les objectifs de cette formation sont:
- apprendre les bases du langages R
- apprendre à utiliser l’IDE Rstudio
- importer des tables de données
- filtrer et trier des tables de données
- réorganiser des tables de données
- réaliser des figures
## Informations pratiques
- Dates : 4 séances de 1h30 par semaine de octobre 2022 à janvier 2023
- Lieu : Centre Blaise Pascal (CBP), ENS de Lyon
- Noms des formateurs : Laurent Modolo, Ghislain Durif, Carine Rey, Laurent Gilquin, Mia Croiset, Nicolas Fontrodona
- Nombre de participants : 4 groupes * 12
## Ressources demandées
Nous utiliserons des instances de l'*appliance* "Rstudio server" déjà utilisée l'année dernière. Les TPs portent sur la prise en main de R et Rstudio, nous aurons besoin d'une VM de 4 vCPU au plus par séance (les stagiaires travailleront sur la même VM via des comptes ad hoc).
### Outils et environnements
- R
- Rstudio
- `tidyverse` R meta-package
Tous ces outils sont intégrés dans l'*appliance* "Rstudio server".
### Resources informatiques
* Taille max des VMs par participant : 4 vCPU, 4Go mémoire RAM, gabarit `ifb.tr.large` (4c 4Go)
* Nombre total d'heures vCPU (vCPU.h) : 4 vCPU * 4 séances/semaine * 14 semaines * 2h (petite marge pour lancer et éteindre les VMs avant et après les séances) = 448 vCPU.h
* Volume de stockage partagé : <1Go
* Besoins spécifiques
- grosse mémoire (RAM > 1 To) : NON
- GPU : NON
- haute fréquence processeur (> 3 GHz) : NON
- parallélisme : 2 vCPU/VM max
Disponibilité des ressources après la formation ? NON
---
## Start
09/10/2023
## End
31/01/2023
# Formation R
## Important
- Faire l'appel à chaque séance.
- On a une douzaine de séance pour couvrir les 8 chapitres, pas de précipitation.
## Liens utiles
- Calendrier partagé indiquant les horaires et salles (au format iCal) à importer dans votre application agenda préférée : https://webmail-preprod.ens-lyon.fr//public/feed/?_cal=Z2R1cmlmOjUzOWQ2OGE4NGVjOTVlOGVkNmJlZmE1NzljZWY5YzM2.ics&_key=NTM5ZDY4YTg0ZWM5NWU4ZWQ2YmVmYTU3OWNlZjljMzZfY2FsaGFzaGtleV82NGY2ZTdmNDA1OTJj
⚠ Les horaires du lundi et la salle du jeudi peuvent être amené à changer.
## Supports
Les supports de formation sont disponibles ici : https://can.gitbiopages.ens-lyon.fr/R_basis/ (sources : https://gitbio.ens-lyon.fr/can/R_basis)
## Ressources
Nous utiliserons les ressources du [Cloud IFB](https://biosphere.france-bioinformatique.fr/):
- il est accessible via vos identifiants institutionnels (e.g. `@ens-lyon.fr`, etc.)
- ⚠ il faut se connecter une première fois pour demander l'activation de votre compte
### Avant la formation
Rejoindre le groupe "CAN R 2023" sur le cloud IFB : cliquer en haut à droite sur l'icone "profil" → "Groupes" → "Rejoindre un groupe"
### Avant chaque séance^[prendre un peu de marge pour le temps de démarrage de la VM]
1. Lancer une VM "Rstudio server" en utilisant le modèle `ifb.tr.large` (4 vCPU et 4Go RAM) et les quotas du groupe "CAN R 2023".
Onglet "RAINBio" → "App Store" → "Rstudio Server" → cliquer sur la clé "Configure":
+ donner un nom
+ choisir le groupe "CAN R 2023"
+ choisir un cloud, par exemple local comme `meso-psmn-cirrus` ou `ifb-prabi-girofle`
+ choisir le modèle `ifb.tr.large` (4 vCPU et 4Go RAM)
2. Accéder à la VM via l'onglet "myVM":
+ Lien *"https"*: ouvre une session Rstudio dans le navigateur (**il faut accepter l'exception de sécurité**)
+ Lien *"params"*: pour récupérer le *login* et *mot de passe*
3. Récupérer le fichier `r_user_list_<day_number>_<day>.csv` correspondant à votre session via le lien qui vous a été fourni sur le serveur nextcloud de l'ENS.
4. Uploader le fichier `r_user_list_<day_number>_<day>.csv` sur la VM (via l'interface graphique de Rstudio, bouton "upload" dans le panel "Files" en bas à droite)
4. Créer des comptes ad hoc pour les stagiaires sur la VM:
```bash
sudo bash create_users_from_user_list_csv.sh r_user_list_<day_number>_<day>.csv
```
### Pendant la séance
Partager l'adresse IP de votre serveur Rstudio aux stagiaires qui pourront se connecter en utilisant leurs identifiants.
### Après chaque séance^[ne surtout pas oublier pour libérer des ressources et économiser notre quota]
**Éteindre la VM** depuis l'onglet "myVM".
File moved
File moved
File moved
# Appel à formateurs/formatrices pour formations "UNIX ligne de commandes" et "R pour les débutant(e)s" automne 2023
Bonjour (english below)
---
TL;DR appel à formateurs/formatrices pour des formations hebdomadaire au semestre d'automne "UNIX ligne de commandes" (1 créneau) et "R pour les débutant(e)s" (4 créneaux), liens pour s'inscrire ci-dessous
---
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s".
Ces formations s'étaleront sur une dizaine de semaines, jusqu'en décembre (sauf pendant les vacances de Toussaint et Noël, avec la possibilité de rajouter quelques séances en janvier si besoin) à raison de 1h30 de travaux pratiques par semaine avec 10 personnes par créneau.
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants : CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (partenaires de la SFR BioSciences).
Afin d'animer ces formations, nous sommes à la recherche de formateurs et formatrices volontaires, idéalement au moins 2 par créneau.
Informations importantes :
- il n'y a pas de préparation, les supports sont prêts
- c'est 1h30 par semaine, on peut facilement échanger si un jour on n'est pas dispo
- les personnes formées sont vraiment débutantes donc les questions ne seront pas complexes et toute aide sera la bienvenue, il faut juste être à l'aise avec R ou avec la ligne de commande sur UNIX (e.g. OS Linux), pas besoin d'être un expert ou une experte.
- et surtout c'est super enrichissant!
Si vous êtes intéressé(e), vous pouvez vous inscrire via les liens suivants :
- UNIX ligne de commandes : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for
- R pour les débutant(e)s : https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r
Planning :
- lundi 13h-14h30 : R pour les débutant(e)s
- mardi 11h-12h30 : UNIX ligne de commandes
- mercredi 11h-12h30 : R pour les débutant(e)s
- jeudi 11h-12h30 : R pour les débutant(e)s (in ENGLISH)
- vendredi 11h-12h30 : R pour les débutant(e)s
Si vous avez des questions, vous pouvez contacter:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
Merci d'avance,
Bien cordialement,
----
Hi,
---
TL;DR call for trainers for the weekly training session during fall semester : "UNIX command line" (1 slot) and "R for beginners" (4 slots), link to register below
---
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners".
These training sessions will take place during around ten weeks, until December (except during Toussaint and Christmas Holidays, with the possibility to add additional slots in January if necessary), with 1h30 of tutorial/practical every week and 10 trainees/slot.
These training sessions are available for all (permanent and non-permanent) members of the following labs: CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (SFR BioSciences partners).
We are looking for volunteers to be trainers, ideally 2 per slot.
Important information :
- no preparation required, training materials are ready
- it is only 1h30 per week (or more if you want to teach multiple sessions), it is possible to switch spots with other trainers if you are not available one time
- trainees will be beginners, so questions will not be too complex and any help is welcomed, you just need to be a regular UNIX command line user (e.g. Linux OS) or R user, no need to be an expert
- and also it is highly rewarding!
If you are interested, please register using the following links :
- UNIX command line: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-unix-ligne-de-commande-call-for-trainers-for
- R for beginners: https://framaforms.org/appel-a-formatrices-et-formateurs-pour-la-formation-r-pour-les-debutantes-call-for-trainers-for-r
Schedule :
- Monday 13h-14h30 : R pour les débutant(e)s
- Tuesday 11h-12h30 : UNIX ligne de commandes
- Wednesday 11h-12h30 : R pour les débutant(e)s
- Thursday 11h-12h30 : R pour les débutant(e)s (in ENGLISH)
- Friday 11h-12h30 : R pour les débutant(e)s
If you have any questions, please contact:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
Thanks in advance,
Best regards,
# Formations "UNIX ligne de commandes" et "R pour les débutant(e)s" automne 2023
Bonjour (english below)
---
TL;DR formations hebdomadaire au semestre d'automne "UNIX ligne de commandes" (10 places sur 1 créneau) et "R pour les débutant(e)s" (40 places sur 4 créneaux), liens pour s'inscrire ci-dessous (merci de bien lire les informations ci-dessous)
---
Le CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) va organiser deux formations sur le semestre d'automne qui débuteront débuts octobre : "UNIX ligne de commandes" et "R pour les débutant(e)s".
Ces formations s'étaleront sur une dizaine de semaines, jusqu'en décembre (sauf pendant les vacances de Toussaint et Noël, avec la possibilité de rajouter quelques séances en janvier si besoin) à raison de 1h30 de travaux pratiques par semaine.
Ces formations sont accessibles à tous les membres (permanents et non permanents) des laboratoires suivants : CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (partenaires de la SFR BioSciences).
Prérequis : avoir un compte @ens-lyon.fr (pour accéder aux ordinateurs des salles de TP) ou avoir un ordinateur portable avec accès à internet via eduroam et un navigateur internet récent (aucune installation spécifique nécessaire, les TPs se font via une plateforme spécifique accessible par son navigateur Internet).
Il y aura 1 créneau hebdomadaire (en français ou anglais suivant la demande) pour la formation UNIX (soit 10 places) et 4 créneaux hebdomadaires pour la formation R (soit 40 places au total), dont 1 créneau en anglais.
Si vous êtes intéressé(e), vous pouvez vous inscrire via les liens suivants :
- UNIX ligne de commandes : https://framaforms.org/formation-unix-ligne-de-commande-unix-command-line-training-session-1693397101
- R pour les débutant(e)s : https://framaforms.org/formation-r-pour-les-debutantes-r-for-beginners-training-session-1693316875
IMPORTANT : En vous inscrivant vous vous engagez à venir sur l'ensemble de la formation (sauf absence ponctuelle en cas d'impératif professionnel ou personnel évidemment).
Planning :
- lundi 13h-14h30 : R pour les débutant(e)s
- mardi 11h-12h30 : UNIX ligne de commandes
- mercredi 11h-12h30 : R pour les débutant(e)s
- jeudi 11h-12h30 : R pour les débutant(e)s (in ENGLISH)
- vendredi 11h-12h30 : R pour les débutant(e)s
Si vous avez des questions, vous pouvez contacter:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
(Note : un e-mail différent sera envoyé pour en appeler aux formateurs et formatrices volontaires)
Les objectifs de ces formations sont :
Pour "UNIX ligne de commandes" :
- comprendre le fonctionnement général d'un ordinateur
- interagir avec un système de type UNIX par une interface en ligne de commande
- utiliser des ressources distantes en ligne de commande
- installer et utiliser des programmes en ligne de commandes
- manipuler des données de types textuelles de manière automatisée
- avoir des notions d'administration sur ce type de système
- avoir des notions en virtualisation de système
Pour "R pour les débutant(e)s" :
- apprendre les bases du langages R
- apprendre à utiliser l’IDE Rstudio
- importer des tables de données
- filtrer et trier des tables de données
- réorganiser des tables de données
- réaliser des figures
Bien cordialement,
----
Hi,
---
TL;DR weekly training session during fall semester : "UNIX command line" (10 places on 1 slot) and "R for beginners" (40 places on 4 slots), link to register below (thanks to carefully read the information below)
---
The CAN (https://www.sfr-biosciences.fr/la-sfr/conseil-analyse-numerique/) will organize two training session during the fall semester (starting in early October): "UNIX command line" and "R for beginners".
These training sessions will take place during around ten weeks, until December (except during Toussaint and Christmas Holidays, with the possibility to add additional slots in January if necessary), with 1h30 of tutorial/practical every week.
These training sessions are available for all (permanent and non-permanent) members of the following labs: CIRI, IGFL, LBMC, RDP, MMSB, LBTI, IVPC, IBCP (SFR BioSciences partners).
Requirement: having an @ens-lyon.fr account (to access computers during the session) or having a laptop with a working eduroam Internet access and a recent web browser (no further installation is required, all practicals will be done via a specific platform available through the web browser).
There will be 1 weekly session (in french or in english depending on the registered persons) pour the UNIX training (10 places) and 4 weekly sessions for the R training (40 places), including 1 session in english.
If you are interested, please register using the following links :
- UNIX command line: https://framaforms.org/formation-unix-ligne-de-commande-1661852334
- R for beginners: https://framaforms.org/formation-r-pour-les-debutantes-1661853807
IMPORTANT: By registering, you agree to attend the entire course (except for one-time absences in case of professional or personal imperative obviously).
Schedule :
- Monday 13h-14h30 : R pour les débutant(e)s
- Tuesday 11h-12h30 : UNIX ligne de commandes
- Wednesday 11h-12h30 : R pour les débutant(e)s
- Thursday 11h-12h30 : R pour les débutant(e)s (in ENGLISH)
- Friday 11h-12h30 : R pour les débutant(e)s
If you have any questions, please contact:
- Ghislain Durif (ghislain.durif@ens-lyon.fr)
- Laurent Modolo (laurent.modolo@ens-lyon.fr)
(Note: a separate e-mail will be send to call for trainers)
The contents of the these training sessions are the following :
For "UNIX command line":
- understand the general functioning of a computer
- interact with a UNIX-type system through the command line interface
- use remote resources through command line
- install and use software and programs through command line
- automatically manipulate text data
- learn basic knowledge of system administration
- learn basic knowledge of system virtualization
For "R for beginners":
- learn basic knowledge of R language programming
- use Rstudio IDE (Integrated Development Environment)
- import data table/array
- filter and sort data table
- reorganize data table
- generate graphics and plots
Best regards,
File moved
#! /usr/bin/bash
# list wifi loing from pdf
echo "login"
pdfgrep "Votre nom de connexion ou login" *.pdf | sed -E 's/.*:.*(z.*)/\1/g'
echo
echo "mot de passe"
pdfgrep "Votre mot de passe initial" FicheLogin*.pdf | sed -E 's/.*:.*([a-Z0-9]{8})$/\1/g'
......@@ -2,45 +2,20 @@
title: 'R.1: Introduction to R and RStudio'
author: "Laurent Modolo [laurent.modolo@ens-lyon.fr](mailto:laurent.modolo@ens-lyon.fr);\n Hélène Polvèche [hpolveche@istem.fr](mailto:hpolveche@istem.fr)"
date: "2022"
output:
rmdformats::downcute:
self_contain: true
use_bookdown: true
default_style: "light"
lightbox: true
css: "../www/style_Rmd.css"
---
```{r include=FALSE}
library(fontawesome)
```
&ensp;`r fa(name = "fas fa-house", fill = "grey", height = "1em")` &ensp;https://can.gitbiopages.ens-lyon.fr/R_basis/
```{r setup, include=FALSE , echo=FALSE}
rm(list=ls())
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
```
```{r klippy_install, echo=FALSE, include=FALSE}
if (! require("klippy")) {
install.packages("remotes")
remotes::install_github("rlesur/klippy")
}
```
```{r klippy, echo=FALSE, include=TRUE}
klippy::klippy(
position = c('top', 'right'),
color = "white",
tooltip_message = 'Click to copy',
tooltip_success = 'Copied !')
```
# Introduction
## Introduction
The goal of this practical is to familiarize yourself with R and the RStudio
environment.
......@@ -59,7 +34,7 @@ The objectives of this session will be to:
![](./img/intro_img.png){width=400px}
</center>
## Acknowledgments
### Acknowledgments
![](./img/software_carpentry_logo.svg){width=300px}
......@@ -69,7 +44,7 @@ The objectives of this session will be to:
- [moderndive.com](https://moderndive.com)
- [swcarpentry.github.io](http://swcarpentry.github.io/r-novice-gapminder/)
## Some R background
### Some R background
![](./img/Rlogo.png){width=40px}
is a programming language and free software environment for statistical
......@@ -105,7 +80,7 @@ bioconductor_packages <- nrow(biocPackages)
- **`r bioconductor_packages`** available packages on http://www.bioconductor.org
- **>500k** available repository using R on https://github.com/
## How do I use R ?
### How do I use R ?
Unlike other statistical software programs like Excel, SPSS, or Minitab that provide [point-and-click](https://en.wikipedia.org/wiki/Point_and_click) interfaces, R is an [interpreted language](https://en.wikipedia.org/wiki/Interpreted_language).
......@@ -117,7 +92,7 @@ R is usually used in a terminal in which you can type or paste your R code:
But navigating between your terminal, your code and your plots can be tedious, this is why in `r format(Sys.time(), "%Y")` there is a better way to use R !
## RStudio, the R Integrated development environment (*IDE*)
### RStudio, the R Integrated development environment (*IDE*)
An IDE application provides **comprehensive facilities** to computer programmers for
software development. Rstudio is **free** and **open-source**.
......@@ -126,11 +101,11 @@ To open RStudio, you can install the [RStudio application](https://www.rstudio.c
Otherwise you can use the link and the login details provided to you by email. The web version of Rstudio is the same as the application expect that you can open it any recent browser.
### Rstudio interface
#### Rstudio interface
![](./img/RStudio.png)
### A R console
#### A R console
The same console as before (in Red box)
......@@ -138,29 +113,31 @@ The same console as before (in Red box)
### A code editor
#### A code editor
We are now going to write our first function.
We are now going to write our first commands.
We could do it directly in the R console, with multi-line commands but this process is tedious.
Instead we are going to use the Rstudio code editor panel, to write our code.
You can go to **File > New File > R script** to open your editor panel.
Beside, you can keep your code history.
![](./img/RStudio_editor.png)
## How to execute R code in Rstudio ?
### How to execute R code in Rstudio ?
RStudio offers you great flexibility in running code from within the editor window. There are buttons, menu choices, and keyboard shortcuts. To run the current line, you can
- click on the `Run button` above the editor panel, or
- select Run Lines from the Code menu, or
- select `Run Selected Lines` from the `Code` menu, or
- hit `Ctrl`+`Return` in Windows or Linux or `Cmd`+`Return` on OS X. To run a block of code, select it and then Run.
If you have modified a line of code within a block of code you have just run, there is no need to reselect the section and Run, you can use the next button along, Rerun the previous region. This will run the previous code block including the modifications you have made.
# R as a Calculator
## R as a Calculator
Now that we know what we should do and what to expect, we are going to try some basic R instructions. A computer can perform all the operations that a calculator can do, so let's start with that:
......@@ -173,8 +150,6 @@ Now that we know what we should do and what to expect, we are going to try some
<div class="pencadre">
Now Open RStudio.
Write the commands in colors in a blue box in the terminal.
The expected results will always be printed in white in a blue box.
You can `copy paste` but I advise you to practice writing directly in the terminal.
Like all the languages, you will become more familiar with R by using it.
......@@ -183,7 +158,7 @@ To validate the line at the end of your command: press `Return`.
</div>
## First commands
### First commands
You should see a `>` character before a blinking cursor. The `>` is called a prompt. The prompt is shown when you can enter a new line of R code.
```{r calculatorstep1, include=T, eval=F}
......@@ -216,7 +191,7 @@ It is waiting for the next command. Write just `100` and press `⏎`:
1 + 100
```
## Errors, warnings, and messages
### Errors, warnings, and messages
The R console is a textual interface, which means that you will enter code, but it also means that R is going to write information back to you and that you will have to pay attention at what is written.
......@@ -227,7 +202,7 @@ There are 3 categories of messages that R can send you: **Errors** prefaced with
- **Message** are just friendly messages from R telling you how things are running.
## R keeps to the mathematical order
### R keeps to the mathematical order
The order of operation is the natural mathematical order in R:
......@@ -250,7 +225,7 @@ But to much parenthesis can be hard to read
**Note :** The text following a `#` is a comment. It will not be interpreted by R. In the future, I advise you to use comments a lot to explain in your own words what the command means.
## Scientific notation
### Scientific notation
For small of large numbers, R will automatically switch to scientific notation.
......@@ -265,7 +240,7 @@ You can use `e` to write your own scientific notation.
5e3
```
## Mathematical functions
### Mathematical functions
R is distributed with a large number of existing functions.
To call mathematical function you must with `function_name(<number>)`.
......@@ -296,7 +271,7 @@ or
factorial(9)
```
## Comparing things
### Comparing things
We have seen some examples that R can do all the things that a calculator can do.
But when we are speaking of programming language, we are thinking of writing [computer programs](https://en.wikipedia.org/wiki/Computer_program).
......@@ -348,7 +323,7 @@ computing and graphics (free & opensource) with a large library of external pack
</div>
# Variables and assignment
## Variables and assignment
In addition to being able to perform a huge number of computations very fast, computers can also store information to memory.
This is a mandatory function to load your data and store intermediate states in your analysis.
......@@ -371,7 +346,7 @@ We can then ask R to display the value of `x`.
x
```
## The environment
### The environment
You now see the `x` value in the environment box (*in red*).
......@@ -423,7 +398,7 @@ You can type `is.` and press `tabulation`.
Rstudio will show you a list of function whose names start with `is.`.
This is called autocompletion, don't hesitate to spam your `tabulation` key as you write R code.
## Variables names
### Variables names
Variable names can contain **letters**, **numbers**, **underscores** and **periods**.
......@@ -464,7 +439,7 @@ celsius2kelvin
</p>
</details>
## Functions are also variables
### Functions are also variables
```{r VandAstep7, include=TRUE}
logarithm <- log
......@@ -512,7 +487,7 @@ Test that your `logarithm` function can work in base 10
</details>
## Writing function
### Writing function
We can define our own function with :
......@@ -557,7 +532,7 @@ function_name <- function(a, b){
**Note: ** if you don't use `return` by default the evaluation of the last line of your function body is returned.
The function variable (here `x`) is independant of the global environment: It defines to which value the operation will be applied in the function body.
**Note: ** The function variables (here `a` and `b`) are independant of the global environment: They define to which values the operation will be applied in the function body.
- The order of arguments is important
......@@ -570,13 +545,13 @@ minus <- function(a, b){
return(result_1)
}
#R1:
##R1:
R1 <- minus(4,2)
#R2
##R2
R2 <- minus(2,4)
#R3
##R3
a <- 2
b <- 10
R3 <- minus(b,a)
......@@ -618,35 +593,41 @@ minus(b,a)
- Naming variables is more explicit and bypasses the order.
<div class="pencadre">
Predict the result of R1, R2 and R3.
Predict the result of R1, R2, R3 and R4.
```R
a <- 10
b <- 2
minus <- function(a, b){
result_1 <- a - b
return(result_1)
}
#R1:
##R1:
R1 <- minus(a=6,b=3)
#R2
##R2
R2 <- minus(b=3,a=6)
#R3
a <- 10
b <- 2
##R3
R3 <- a
R3 <- minus(b=b,a=a)
##R4
R4 <- minus(b=b,a=a)
```
</div>
<details><summary>Solution 1</summary>
<p>
```{r minus21, include=TRUE}
a <- 10
b <- 2
minus <- function(a, b){
result_1 <- a - b
return(result_1)
}
minus(a=6,b=3)
R1 <- minus(a=6,b=3)
R1
```
</p>
</details>
......@@ -655,7 +636,8 @@ minus(a=6,b=3)
<details><summary>Solution 2</summary>
<p>
```{r minus22, include=TRUE}
minus(b=3,a=6)
R2 <- minus(b=3,a=6)
R2
```
</p>
</details>
......@@ -664,9 +646,17 @@ minus(b=3,a=6)
<details><summary>Solution 3</summary>
<p>
```{r minus23, include=TRUE}
a <- 10
b <- 2
minus(b=b,a=a)
R3 <- a
R3
```
</p>
</details>
<details><summary>Solution 4</summary>
<p>
```{r minus24, include=TRUE}
R4 <- minus(b=b,a=a)
R4
```
</p>
</details>
......@@ -714,7 +704,7 @@ print_hw()
</details>
## Some exercices
### Some exercices
<div class="pencadre">
1. Try a function (`rect_area`) to calculate the area of a rectangle of length "L" and width "W"
......@@ -727,6 +717,8 @@ of the modulo is equal to `0`.
13 %% 2
```
3. Using your `even_test` function, write a new function `even_print` which will print "This number is even" or "This number is odd". You will need the `if else` statement and the function `print`. Find help on how to use them.
</div>
<details><summary>Solution 1 </summary>
......@@ -757,7 +749,7 @@ even_test(3)
**Note :** A function can be written in several forms.
```{r VandAstep11small, include=TRUE}
```{r VandAstep11smal2, include=TRUE}
even_test2 <- function(x){
(x %% 2) == 0
}
......@@ -768,7 +760,39 @@ even_test(3)
</details>
## Cleaning up
<details><summary>Solution 3 </summary>
<p>
```{r VandAstep13, include=TRUE}
even_print <- function(x){
if(even_test(x) == TRUE) {
print("This number is even")
} else {
print("This number is odd")
}
}
even_print(4)
even_print(3)
```
**Note :** There is no need to test whether a boolean variable (TRUE/FALSE) is TRUE or FALSE.
```{r VandAstep11small14, include=TRUE}
even_print <- function(x){
if(even_test(x)) {
print("This number is even")
} else {
print("This number is odd")
}
}
even_print(4)
even_print(3)
```
</p>
</details>
### Cleaning up
We can now clean your environment
......@@ -818,12 +842,12 @@ ls()
</div>
# Complex variable type
## Complex variable type
You can only go so far with the variables we have already seen.
In R there are also **complex variable type**, which can be seen as combination of simple variable type.
## Vector (aka list)
### Vector (aka list)
Vectors are simple list of variable of the same type
......@@ -857,7 +881,6 @@ To determine the type of the elements of a vector:
typeof(x)
```
```{r Vecstep6, include=TRUE}
typeof(x + 0.5)
x + 0.5
......@@ -883,6 +906,51 @@ y
x == y
```
### Accessing values
There are multiple ways to access or replace values in vectors or other data structures. The most common approach is to use "indexing".
In the below, note that brackets `[ ]` are used for indexing, whereas you have already seen that parentheses `( )` are used to call a function and `{ }` to define function. It is very important not to mix these up.
Here are some examples that show how elements of vectors can be obtained by indexing.
You can use the position(s) of the value(s) in the vector
```{r index1, include=TRUE}
x <- c(1,5,7,8)
x[4]
x[c(1,3,4)]
```
You can use booleans to define which values should be kept.
```{r index2, include=TRUE}
x <- c(1,5,7,8,15)
x[c(TRUE,FALSE,TRUE,FALSE,TRUE)]
x[c(FALSE,TRUE)] # Bolean vector is reused if it is not of the same size of the vector to index
y <- c(TRUE,FALSE,FALSE,FALSE,TRUE)
x[y]
```
You can use names in the case of a named vector.
```{r index3, include=TRUE}
x <-c(a = 1, b = 2, c = 3, d = 4, e = 5)
x[c("a","c")]
```
You can also use an index to change values
```{r index4, include=TRUE}
x <- c(1,5,7,8,15)
x[1] <- 3
x
x[x>5] <- 13
x
```
<div class="pencadre">
**Summary so far**
......@@ -894,7 +962,7 @@ x == y
We will see other complex variables type during this formation.
# Packages
## Packages
R base is like a new smartphone, you can do loots of things with it but you can also install new apps to a huge range of other things.
In R those apps are called **packages**.
......@@ -902,14 +970,14 @@ In R those apps are called **packages**.
There are different sources to get packages from:
- The [CRAN](https://cran.r-project.org/) which is the default source
- [Bioconducor](http://www.bioconductor.org) which is another source specialized for biology packages (more information [here](./bioconductor.html))
- Directly from [github](https://github.com/)(more information [here](./github.html))
- [Bioconducor](http://www.bioconductor.org) which is another source specialized for biology packages
- Directly from [github](https://github.com/)
To install packages from [Bioconducor](http://www.bioconductor.org) and [github](https://github.com/) you will need to install specific packages from the [CRAN](https://cran.r-project.org/).
## Installing packages
### Installing packages
### From CRAN
#### From CRAN
To install packages, you can use the `install.packages` function (don't forget to use tabulation for long variable names).
......@@ -932,7 +1000,7 @@ install.packages("ggplot2")
</p>
</details>
### From Bioconducor
#### From Bioconducor
To install packages from [bioconductor](http://www.bioconductor.org) you must first install a package called "BiocManager".
This package imports a function called "install" allowing you to install packages hosted in bioconductor from their name.
......@@ -949,7 +1017,7 @@ Then to install, for example "tximport", you just have to write:
BiocManager::install("tximport")
```
### From github
#### From github
If you need to install a package that is not available on the CRAN but on a github repository, you can do it using the "remotes" package. Indeed this package imports functions that will allow you to install a package available on [github](https://github.com/) or bitbucket or gitlab directly on your computer.
......@@ -975,7 +1043,7 @@ remotes::install_github("thomasp85/gganimate@v1.0.7")
You can find more information in the documentation of remotes : [https://remotes.r-lib.org](https://remotes.r-lib.org)
## Loading packages
### Loading packages
Once a package is installed, you need to load it in your R session to be able to use it.
The command `sessionInfo` display your session information.
......@@ -998,7 +1066,7 @@ sessionInfo()
</p>
</details>
## Unloading packages
### Unloading packages
Sometime, you may want to unload package from your session instead of relaunching R.
......@@ -1010,10 +1078,10 @@ unloadNamespace("ggplot2")
sessionInfo()
```
## Help on packages (when existing)
### Help on packages (when existing)
```R
browseVignettes("ggplot2")
```
## See you in [Session 2 : "Introduction to Tidyverse"](https://can.gitbiopages.ens-lyon.fr/R_basis/session_2.html)
### See you in [R.2: "Introduction to Tidyverse"](/session_2/session_2.html)