-
Notifications
You must be signed in to change notification settings - Fork 7
/
jour2.html
184 lines (169 loc) · 10.1 KB
/
jour2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html>
<head>
<title>Introduction à R</title>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jour2_files/rmdshower/node_modules/shower-ribbon/styles/screen-4x3.css">
<link rel="stylesheet" href="jour2_files/rmdshower/style-common.css">
<link rel="stylesheet" href="jour2_files/rmdshower/style-ribbon.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.js"></script>
<script src="jour2_files/rmdshower/auto-render.min.js" type="text/javascript"></script>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
</head>
<body class="shower list">
<header class="caption">
<h1>Introduction à R</h1>
<p>Open Data France et datactivi.st</p>
</header>
<section id="introduction-a-r-le-couteau-suisse-de-la-data-science" class="slide level2">
<h2>Introduction à R, le couteau suisse de la data science</h2>
<p>
</p>
<p>
</p>
Jour 2
<p>
</p>
<p>
</p>
<p>
Joël Gombin et Samuel Goëta (datactivi.st)
</p>
<p>
Retrouvez les matériaux sur : <a href="www.github.com/datactivist/IntroR_ODF" class="uri">www.github.com/datactivist/IntroR_ODF</a>
</p>
<p>
Pad collaboratif : <a href="https://frama.link/formationR_pad2" class="uri">https://frama.link/formationR_pad2</a>
</p>
</section>
<section id="installation-de-r-et-rstudio" class="titleslide slide level1"><h2 class="shout">Installation de R et Rstudio</h2></section><section id="installation-de-r-et-rstudio-1" class="slide level2">
<h2>Installation de R et Rstudio</h2>
<ul>
<li class="fragment next"><a href="http://www.r-project.org" class="uri">http://www.r-project.org</a> / <a href="http://cran.univ-paris1.fr/" class="uri">http://cran.univ-paris1.fr/</a></li>
<li class="fragment next"><p><a href="https://www.rstudio.com/products/rstudio/download" class="uri">https://www.rstudio.com/products/rstudio/download</a> / <a href="https://www.rstudio.com/products/rstudio/download/preview" class="uri">https://www.rstudio.com/products/rstudio/download/preview</a></p></li>
<li class="fragment next"><p>(Usagers MacOS X : si difficulté à installer XCode => <a href="https://github.com/kennethreitz/osx-gcc-installer" class="uri">https://github.com/kennethreitz/osx-gcc-installer</a>)</p></li>
<li class="fragment next"><p>installer le <code>tidyverse</code> : <code>install.packages("tidyverse")</code></p></li>
</ul>
</section><section id="prise-en-main-de-rstudio" class="slide level2">
<h2>Prise en main de Rstudio</h2>
<ul>
<li class="fragment next">interface utilisateur</li>
<li class="fragment next">notion de projets</li>
</ul>
</section><section id="trouver-de-laide-avec-r-rstudio" class="slide level2">
<h2>Trouver de l’aide avec R / Rstudio</h2>
<ul>
<li class="fragment next"><code>?help</code></li>
<li class="fragment next">autocomplete</li>
<li class="fragment next">google => stackoverflow / blogs / github / twitter (<a href="https://twitter.com/search?vertical=default&q=%23rstats&src=typd">#Rstats</a>) / etc.</li>
<li class="fragment next">ressources en ligne. Notamment : <a href="http://r4ds.had.co.nz/">r4ds</a>, <a href="http://adv-r.had.co.nz/">adv-r</a>, <a href="https://www.manning.com/books/r-in-action-second-edition">R in action</a>, <a href="https://github.com/juba/intro-r">Intro à R</a>, <a href="http://larmarange.github.io/analyse-R/">analyse-R</a>…</li>
<li class="fragment next">listes de diffusion et forums francophones : <a href="mailto:semin-r@mnhn.fr">semin-r@mnhn.fr</a>, <a href="mailto:fltaur@yahoogroupes.fr">fltaur@yahoogroupes.fr</a>, <a href="mailto:r-soc@groupes.renater.fr">r-soc@groupes.renater.fr</a>, <a href="http://forums.cirad.fr/logiciel-R/" class="uri">http://forums.cirad.fr/logiciel-R/</a>…</li>
<li class="fragment next"><a href="http://www.meetup.com/fr-FR/rparis/">meetups R</a>…</li>
</ul>
</section>
<section id="scripter-documenter-repliquer" class="titleslide slide level1"><h2 class="shout">Scripter, documenter, répliquer</h2></section><section id="mon-premier-script-r" class="slide level2">
<h2>Mon premier script R</h2>
</section><section id="mon-premier-notebook-r" class="slide level2">
<h2>Mon premier notebook R</h2>
</section><section id="mon-premier-document-rmarkdown" class="slide level2">
<h2>Mon premier document Rmarkdown</h2>
</section>
<section id="importer-des-donnees" class="titleslide slide level1"><h2 class="shout">Importer des données</h2></section><section id="en-gui-ou-en-cli" class="slide level2">
<h2>En GUI ou en CLI</h2>
<ul>
<li class="fragment next">bouton “Import dataset”</li>
<li class="fragment next">en CLI : package <code>readr</code> pour le CSV, <code>haven</code> pour SPSS / SAS / Stata, <code>readxl</code> pour le XLS(X), <code>rio</code> pour (presque) tout le reste</li>
</ul>
</section><section id="importez-votre-premier-jeu-de-donnees" class="slide level2">
<h2>Importez votre premier jeu de données !</h2>
<ul>
<li class="fragment next">chargement de package : <code>library(readr)</code></li>
<li class="fragment next">Attention à l’assignation : <code>monjeudedonnees <- read_csv</code></li>
<li class="fragment next">Un exemple : <a href="https://www.data.gouv.fr/fr/datasets/aides-percues-par-les-personnes-morales-au-titre-de-la-politique-agricole-commune/">les aides perçues au titre de la PAC</a></li>
</ul>
</section><section id="la-notion-de-fonction" class="slide level2">
<h2>La notion de fonction</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">sum</span>(<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>)</code></pre></div>
<pre><code>## [1] 6</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">a <-<span class="st"> </span><span class="kw">sum</span>(<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>)
a</code></pre></div>
<pre><code>## [1] 6</code></pre>
</section>
<section id="le-tidyverse" class="titleslide slide level1"><h2 class="shout">Le tidyverse</h2></section><section id="la-notion-de-tidy-data" class="slide level2">
<h2>La notion de tidy data</h2>
<blockquote>
<p>“Happy families are all alike; every unhappy family is unhappy in its own way.” – Leo Tolstoy</p>
</blockquote>
<blockquote>
<p>“Tidy datasets are all alike, but every messy dataset is messy in its own way.” – Hadley Wickham</p>
</blockquote>
<ul>
<li class="fragment next">À chaque variable sa propre colonne</li>
<li class="fragment next">À chaque observation sa propre ligne</li>
<li class="fragment next">À chaque valeur sa propre cellule</li>
</ul>
</section><section id="la-notion-de-tidy-data-1" class="slide level2">
<h2>La notion de tidy data</h2>
<p><img src="img/tidy-1.png" width="90%" style="display: block; margin: auto;" /></p>
</section><section id="la-notion-de-tidy-data-2" class="slide level2">
<h2>La notion de tidy data</h2>
<ul>
<li class="fragment next">Mettre chaque jeu de données dans un <code>tibble</code></li>
<li class="fragment next">Mettre chaque variable dans une colonne</li>
</ul>
</section><section id="un-exemple-de-untidy-data" class="slide level2">
<h2>Un exemple de untidy data</h2>
<p><a href="https://www.data.gouv.fr/fr/datasets/election-presidentielle-2012-resultats-572126/" class="uri">https://www.data.gouv.fr/fr/datasets/election-presidentielle-2012-resultats-572126/</a></p>
</section><section id="nettoyage-et-preparation-de-ce-jeu-de-donnees" class="slide level2">
<h2>Nettoyage et préparation de ce jeu de données</h2>
</section>
<!--
To hide progress bar from entire presentation
just remove “progress” element.
-->
<!-- <div class="progress"></div> -->
<script src="jour2_files/rmdshower/node_modules/shower/node_modules/shower-core/shower.min.js"></script>
<!-- Copyright © 2015 Yours Truly, Famous Inc. -->
<!-- Photos by John Carey, fiftyfootshadows.net -->
<script>renderMathInElement(document.body);</script>
</body>
</html>