Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!DOCTYPE html>
  2. <html lang="" xml:lang="">
  3. <head>
  4. <title>Données tabulaires</title>
  5. <meta charset="utf-8" />
  6. <meta name="author" content="Maxime Wack" />
  7. <script src="libs/header-attrs-2.1/header-attrs.js"></script>
  8. <link href="libs/remark-css-0.0.1/default.css" rel="stylesheet" />
  9. <script src="libs/htmlwidgets-1.5.1/htmlwidgets.js"></script>
  10. <script src="libs/jquery-1.12.4/jquery.min.js"></script>
  11. <link href="libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet" />
  12. <script src="libs/datatables-binding-0.13/datatables.js"></script>
  13. <link href="libs/dt-core-1.10.20/css/jquery.dataTables.min.css" rel="stylesheet" />
  14. <link href="libs/dt-core-1.10.20/css/jquery.dataTables.extra.css" rel="stylesheet" />
  15. <script src="libs/dt-core-1.10.20/js/jquery.dataTables.min.js"></script>
  16. <link href="libs/crosstalk-1.1.0.1/css/crosstalk.css" rel="stylesheet" />
  17. <script src="libs/crosstalk-1.1.0.1/js/crosstalk.min.js"></script>
  18. <link rel="stylesheet" href="css/my_style.css" type="text/css" />
  19. </head>
  20. <body>
  21. <textarea id="source">
  22. class: center, middle, title
  23. # UE Visualisation
  24. ### 2020-2021
  25. ## Dr. Maxime Wack
  26. ### AHU Informatique médicale
  27. #### Hôpital Européen Georges Pompidou, &lt;/br&gt; Université de Paris
  28. ---
  29. # Données tabulaires
  30. .center[Chargement des données avec `read_csv`]
  31. ```r
  32. read_csv("lab03-data/notes.csv") -&gt; notes
  33. ```
  34. <div id="htmlwidget-f5059698d71e2c376fcf" style="width:100%;height:auto;" class="datatables html-widget"></div>
  35. <script type="application/json" data-for="htmlwidget-f5059698d71e2c376fcf">{"x":{"filter":"none","data":[["1/1/2019","1/15/2019","2/1/2019","2/15/2019","3/1/2019","3/15/2019","4/1/2019","4/15/2019","5/1/2019","5/15/2019"],[14,16,15,17,14,15,13,15,16,17],[10,11,11,10,15,13,12,12,13,11],[18,19,18,19,19,20,19,19,17,18],[9,10,12,11,14,13,14,15,14,15]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Date<\/th>\n <th>Alice<\/th>\n <th>Bob<\/th>\n <th>Claire<\/th>\n <th>David<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"paging":false,"info":false,"searching":false,"columnDefs":[{"className":"dt-right","targets":[1,2,3,4]}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
  36. ---
  37. # Pivot
  38. .center[Données *wide* → *long*]
  39. ```r
  40. pivot_longer(notes,
  41. Alice:David,
  42. names_to = "Prénom",
  43. values_to = "Note") -&gt; notes_long
  44. ```
  45. <div id="htmlwidget-d3acf82e5da55982884c" style="width:100%;height:auto;" class="datatables html-widget"></div>
  46. <script type="application/json" data-for="htmlwidget-d3acf82e5da55982884c">{"x":{"filter":"none","data":[["1/1/2019","1/1/2019","1/1/2019","1/1/2019","1/15/2019","1/15/2019","1/15/2019","1/15/2019","2/1/2019","2/1/2019","2/1/2019","2/1/2019","2/15/2019","2/15/2019","2/15/2019","2/15/2019","3/1/2019","3/1/2019","3/1/2019","3/1/2019","3/15/2019","3/15/2019","3/15/2019","3/15/2019","4/1/2019","4/1/2019","4/1/2019","4/1/2019","4/15/2019","4/15/2019","4/15/2019","4/15/2019","5/1/2019","5/1/2019","5/1/2019","5/1/2019","5/15/2019","5/15/2019","5/15/2019","5/15/2019"],["Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David","Alice","Bob","Claire","David"],[14,10,18,9,16,11,19,10,15,11,18,12,17,10,19,11,14,15,19,14,15,13,20,13,13,12,19,14,15,12,19,15,16,13,17,14,17,11,18,15]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Date<\/th>\n <th>Prénom<\/th>\n <th>Note<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"paging":false,"info":false,"searching":false,"columnDefs":[{"className":"dt-right","targets":2}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
  47. ---
  48. # Pivot
  49. .center[Données *long* → *wide*]
  50. ```r
  51. pivot_wider(notes_long,
  52. names_from = Prénom,
  53. values_from = Note)
  54. ```
  55. <div id="htmlwidget-75b346f1165091af2cbb" style="width:100%;height:auto;" class="datatables html-widget"></div>
  56. <script type="application/json" data-for="htmlwidget-75b346f1165091af2cbb">{"x":{"filter":"none","data":[["1/1/2019","1/15/2019","2/1/2019","2/15/2019","3/1/2019","3/15/2019","4/1/2019","4/15/2019","5/1/2019","5/15/2019"],[14,16,15,17,14,15,13,15,16,17],[10,11,11,10,15,13,12,12,13,11],[18,19,18,19,19,20,19,19,17,18],[9,10,12,11,14,13,14,15,14,15]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Date<\/th>\n <th>Alice<\/th>\n <th>Bob<\/th>\n <th>Claire<\/th>\n <th>David<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"paging":false,"info":false,"searching":false,"columnDefs":[{"className":"dt-right","targets":[1,2,3,4]}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
  57. ---
  58. # Exercices
  59. Utiliser les fonctions de `pivot_*` pour exprimer le dataset `gapminder` de différentes manières.
  60. ### Représenter l'intégralité sous forme clé-valeur
  61. Chaque ligne ne doit porter qu'une valeur de `lifeExp`, `gdpPercap` ou `pop`, pour chaque pays et chaque année.
  62. ### Représenter un pays par ligne
  63. Une seule ligne par pays, toutes les années × indicateur doivent donner lieu à une nouvelle colonne
  64. ### Reformer gapminder à partir du précédent exercice
  65. </textarea>
  66. <style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
  67. <script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
  68. <script src="addons/macros.js"></script>
  69. <script>var slideshow = remark.create({
  70. "ratio": "4:3",
  71. "countIncrementalSlides": false,
  72. "self-contained": true,
  73. "highlightLines": true
  74. });
  75. if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
  76. window.dispatchEvent(new Event('resize'));
  77. });
  78. (function(d) {
  79. var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
  80. if (!r) return;
  81. s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
  82. d.head.appendChild(s);
  83. })(document);
  84. (function(d) {
  85. var el = d.getElementsByClassName("remark-slides-area");
  86. if (!el) return;
  87. var slide, slides = slideshow.getSlides(), els = el[0].children;
  88. for (var i = 1; i < slides.length; i++) {
  89. slide = slides[i];
  90. if (slide.properties.continued === "true" || slide.properties.count === "false") {
  91. els[i - 1].className += ' has-continuation';
  92. }
  93. }
  94. var s = d.createElement("style");
  95. s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
  96. d.head.appendChild(s);
  97. })(document);
  98. // delete the temporary CSS (for displaying all slides initially) when the user
  99. // starts to view slides
  100. (function() {
  101. var deleted = false;
  102. slideshow.on('beforeShowSlide', function(slide) {
  103. if (deleted) return;
  104. var sheets = document.styleSheets, node;
  105. for (var i = 0; i < sheets.length; i++) {
  106. node = sheets[i].ownerNode;
  107. if (node.dataset["target"] !== "print-only") continue;
  108. node.parentNode.removeChild(node);
  109. }
  110. deleted = true;
  111. });
  112. })();
  113. (function() {
  114. "use strict"
  115. // Replace <script> tags in slides area to make them executable
  116. var scripts = document.querySelectorAll(
  117. '.remark-slides-area .remark-slide-container script'
  118. );
  119. if (!scripts.length) return;
  120. for (var i = 0; i < scripts.length; i++) {
  121. var s = document.createElement('script');
  122. var code = document.createTextNode(scripts[i].textContent);
  123. s.appendChild(code);
  124. var scriptAttrs = scripts[i].attributes;
  125. for (var j = 0; j < scriptAttrs.length; j++) {
  126. s.setAttribute(scriptAttrs[j].name, scriptAttrs[j].value);
  127. }
  128. scripts[i].parentElement.replaceChild(s, scripts[i]);
  129. }
  130. })();
  131. (function() {
  132. var links = document.getElementsByTagName('a');
  133. for (var i = 0; i < links.length; i++) {
  134. if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
  135. links[i].target = '_blank';
  136. }
  137. }
  138. })();
  139. // adds .remark-code-has-line-highlighted class to <pre> parent elements
  140. // of code chunks containing highlighted lines with class .remark-code-line-highlighted
  141. (function(d) {
  142. const hlines = d.querySelectorAll('.remark-code-line-highlighted');
  143. const preParents = [];
  144. const findPreParent = function(line, p = 0) {
  145. if (p > 1) return null; // traverse up no further than grandparent
  146. const el = line.parentElement;
  147. return el.tagName === "PRE" ? el : findPreParent(el, ++p);
  148. };
  149. for (let line of hlines) {
  150. let pre = findPreParent(line);
  151. if (pre && !preParents.includes(pre)) preParents.push(pre);
  152. }
  153. preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
  154. })(document);</script>
  155. <script>
  156. slideshow._releaseMath = function(el) {
  157. var i, text, code, codes = el.getElementsByTagName('code');
  158. for (i = 0; i < codes.length;) {
  159. code = codes[i];
  160. if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
  161. text = code.textContent;
  162. if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
  163. /^\$\$(.|\s)+\$\$$/.test(text) ||
  164. /^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
  165. code.outerHTML = code.innerHTML; // remove <code></code>
  166. continue;
  167. }
  168. }
  169. i++;
  170. }
  171. };
  172. slideshow._releaseMath(document);
  173. </script>
  174. <!-- dynamically load mathjax for compatibility with self-contained -->
  175. <script>
  176. (function () {
  177. var script = document.createElement('script');
  178. script.type = 'text/javascript';
  179. script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
  180. if (location.protocol !== 'file:' && /^https?:/.test(script.src))
  181. script.src = script.src.replace(/^https?:/, '');
  182. document.getElementsByTagName('head')[0].appendChild(script);
  183. })();
  184. </script>
  185. </body>
  186. </html>