-
Notifications
You must be signed in to change notification settings - Fork 0
/
Xaringan-Parte1.html
872 lines (634 loc) · 34.7 KB
/
Xaringan-Parte1.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<title>Xaringan</title>
<meta charset="utf-8" />
<meta name="author" content="Miriam Lerma" />
<script src="Xaringan-Parte1_files/header-attrs-2.20/header-attrs.js"></script>
<meta name="github-repo" content="MiriamLL/Curso_CIAD"/>
<meta name="twitter:title" content="Xaringan"/>
<meta name="twitter:description" content="Introduccion a RmdCurso de R"/>
<meta name="twitter:url" content="https://github.com/MiriamLL/Curso_CIAD/blob/main/Clase11.html"/>
<meta name="twitter:image:alt" content="Introduccion a R y RStudioCurso de R"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:creator" content="@MiriamLL"/>
<meta name="twitter:site" content="@MiriamLL"/>
<meta property="og:title" content="Xaringan"/>
<meta property="og:description" content="Introduccion a RmdCurso de R"/>
<meta property="og:url" content="https://github.com/MiriamLL/Curso_CIAD/blob/main/Clase11.html"/>
<meta property="og:image:alt" content="Introduccion a R y RStudioCurso de R"/>
<meta property="og:type" content="website"/>
<meta property="og:locale" content="en_US"/>
<meta property="article:author" content="Miriam Lerma"/>
<script src="Xaringan-Parte1_files/clipboard-2.0.6/clipboard.min.js"></script>
<link href="Xaringan-Parte1_files/xaringanExtra-clipboard-0.2.6/xaringanExtra-clipboard.css" rel="stylesheet" />
<script src="Xaringan-Parte1_files/xaringanExtra-clipboard-0.2.6/xaringanExtra-clipboard.js"></script>
<script>window.xaringanExtraClipboard(null, {"button":"Copy Code","success":"Copied!","error":"Press Ctrl+C to Copy"})</script>
<link href="Xaringan-Parte1_files/panelset-0.2.6/panelset.css" rel="stylesheet" />
<script src="Xaringan-Parte1_files/panelset-0.2.6/panelset.js"></script>
<link rel="stylesheet" href="Rmd-themer-darker.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: title-slide, center, middle
background-image: url(https://images.unsplash.com/photo-1484291470158-b8f8d608850d?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80)
background-size: cover
### <span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #1d3557 !important;" >Presentar tus resultados usando</span>
# <span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #1d3557 !important;font-size: 120px;" >Xaringan</span>
<br>
<h2><span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #264653 !important;" >Miriam Lerma</span></h2>
<h3><span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #0A121F !important;" >Abril 2021</span></h3>
---
class: inverse
# Intro
- [Que es Xaringan](#intro)
- [Como agregar fondos](#fondos)
- [Como agregar imagenes](#imagenes)
- [Como agregar tablas](#tablas)
- [Como agregar graficas](#graficas)
## Ustedes
- Tienen conocimientos básicos Rmd o md.
- Quieren poder hacer una presentación desde RStudio.
## Responder en el chat 💬
- En que programa realizan sus presentaciones?
- Han escuchado de Xaringan? A que les suena ?
---
class: inverse
# Créditos y recursos
- Desarrolladores<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Xaringan por Yihui Xie](https://github.com/yihui/xaringan)<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Xaringan-themer por Garrick Aden-Buie](https://www.garrickadenbuie.com/)<br>
- Tutoriales en español<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Introduccion a Xaringan por Silvia Canelon](https://silvia.rbind.io/talk/2020-12-17-introduccion-xaringan/)<br>
- Tutoriales en inglés<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Xaringan avanzado por Silvia Canelon](https://spcanelon.github.io/xaringan-basics-and-beyond/)<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Xaringan por Alison Hill](https://alison.rbind.io/talk/2019-rsc-xaringan/)<br>
- Básicos de <br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Que es CSS](https://www.w3.org/Style/CSS/Overview.en.html)<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Trucos de CSS](https://css-tricks.com/almanac/)
- El paquete [datos](https://cienciadedatos.github.io/datos/) por [Riva Quiroga](https://twitter.com/rivaquiroga)
- Portada de [unsplash](https://unsplash.com/)
---
name: intro
## 1.1. Xaringan
Xaringan fue desarrollado por **[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Yihui Xie](https://github.com/yihui/xaringan)** <br>
La principal **ventaja** de usar Xaringan es que podemos hacer presentaciones mostrando código.
También que podemos hacer nuestros análisis y presentar nuevos resultados sin tener que salir de RStudio.
Ademas, si hay conexión de Internet olvídense de necesitar una USB.
El nombre **Xaringan** proviene de una caricatura.
<br>
.right[
<img src="https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg" width="150" />
]
---
## 1.2. Instalar el paquete
Para instalar el paquete hay dos opciones:
- En RStudio
```r
install.packages('xaringan')
```
- Desde [Github](https://github.com/yihui/xaringan)
```r
devtools::install_github("yihui/xaringan")
```
---
## 1.3. Como funciona?
- La primera diapositiva comienza después del **YAML**
- Las diapositivas se separan una de la otra con usando tres guiones **(---)**
- Diapositivas increméntales se separan con dos guiones **(--)**
---
**Nota** <br>
Es importante no tener espacios después de los guiones. Si no aparecerá una raya.
---
---
## 1.4. Texto
Para escribir texto se usa lo mismo que en Rmd. <br>
Para recordar como escribir texto en [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Rmd](https://miriamll.github.io/Curso_CIAD/Rmd-Parte1)
- Encabezados usando numerales (#, ##, ###)<br>
- Negrita y cursiva usando asteriscos (*)<br>
- Enlaces con corchetes y paréntesis [ ] ( ) <br>
- Listas de puntos que se pueden crear con -, +, o con *<br>
---
## 1.5. Mover contenido
Para seleccionar donde aparecerá el contenido se puede escribir **class** antes del contenido y después de los tres guiones.
```r
---
class: center, middle
```
Para mover el contenido de manera **horizontal** <svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M377.941 169.941V216H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296h243.882v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.568 0-33.941l-86.059-86.059c-15.119-15.12-40.971-4.412-40.971 16.97z"/></svg> se debe especificar en la clase
```r
- left
- center
- right
```
Para mover el contenido de manera **vertical** <svg aria-hidden="true" role="img" viewBox="0 0 256 512" style="height:1em;width:0.5em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z"/></svg> se debe especificar en la clase
```r
- top
- middle
- bottom
```
Estas instrucciones se basan en [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> CSS: Cascading Style Sheets](https://www.w3.org/Style/CSS/Overview.en.html)
---
## 1.5. Mover contenido
Para mover contenido especifico dentro de la dispositiva se puede usar
```r
.left[]
.right[]
.center[]
```
Se debe escribir un punto antes y el contenido entre corchetes [ ].
Aplica para texto, imágenes, gráficos u otros. <br>
---
<br>
.left[El contenido aparece a la izquierda usando **left**...]
.right[...y a la derecha usando **right**]
<br>
.center[El contenido aparece en el centro cuando el texto esta entre corchetes despues de un punto y de la palabra **center**]
---
## 1.5. Alinear por columnas
Si queremos que el texto aparezca en la misma linea <br>
Se puede mover por columnas regulares <br>
Poniendo un punto antes y el contenido entre corchetes [ ].
```r
.pull-left[]
.pull-righ[]
```
---
<br>
.pull-left[Este contenido esta dentro de **pull - left**]
.pull-right[Y este contenido esta dentro de **pull - right**]
---
## 1.5. Alinear por columnas
Si queremos que el contenido aparezca en la misma linea <br>
Se puede mover por columnas irregulares <br>
Poniendo un punto antes y el contenido entre corchetes [ ].
```r
.left-column[]
.rigth-column[]
```
---
<br>
.left-column[Este contenido esta dentro de **left - column**]
.right-column[Este contenido esta dentro de **right - column**]
---
name: fondos
## 1.6. Fondos
Para agregar imágenes que **no** estén en su computadora existen paginas web que tienen contenido que puede ser usado sin atribucion y sin fines de lucro.
Algunas son:
- [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Unsplash](www.unsplash.com)
- [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Rawpixel](www.rawpixel.com)
- [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Pexels](www.pexels.com)
---
## 1.6. Fondos
Para agregar fondos se agrega la ruta de la imagen después de los guiones y especificando **background-image**
```r
---
background-image: enlace_a_la_imagen.jpg
```
Si no ponemos nada utiliza el tamaño de la imagen como fondo, pero el tamaño se puede ajustar usando:
```r
background-size: cover
background-size: contain
```
Para que la imagen aparezca fuera del centro se puede usar **background-position**
```r
background-position: -10%
```
---
class: title-slide, center, middle
background-image: url(https://images.unsplash.com/photo-1544817287-d26f7ed1e4d9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80)
<h1> Sin especificar </h1>
---
class: title-slide, center, middle
background-image: url(https://images.unsplash.com/photo-1544817287-d26f7ed1e4d9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80)
background-size: cover
<h1> Cover</h1>
---
class: title-slide, center, middle
background-image: url(https://images.unsplash.com/photo-1544817287-d26f7ed1e4d9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80)
background-size: contain
<h1> Contain</h1>
---
class: title-slide, center, middle
background-image: url(https://images.unsplash.com/photo-1544817287-d26f7ed1e4d9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80)
background-position: -5%
<h1> background-position </h1>
---
name: imagenes
## 1.7. Imagenes
Para agregar imágenes se usa signo de admiración y corchetes, y dentro de paréntesis la ruta de la imagen.
```r
![](Folder/nombre_de_la_imagen.jpg)
```
También se pueden agregar imagenes dentro de un chunk.
```r
knitr::include_graphics("Folder/nombre_de_la_imagen.jpg")
```
O usando [html HyperText Markup Lenguage](https://es.wikipedia.org/wiki/HTML)
```r
<img src="Folder/nombre_de_la_imagen.jpg" width="90%"/>
```
No necesitan saber html para poder hacer presentaciones! <br> .right[...pero conocer un poco les ayudara a hacer más cosas en Xaringan. ]
---
## 1.7. Imagenes
Se pueden agregar pie de foto para dar credito usando:
```r
.footnote[]
```
<img src="https://images.unsplash.com/photo-1544817287-d26f7ed1e4d9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80" height="350" />
.footnote[Texto dentro de footnote, imagen por Eamonn Maguire]
---
## 1.8. Tamaño de la imagen
Para ajustar el tamaño de la imagen
En knitr se puede usar **out.height**.
```r
{r, out.height=400}
knitr::include_graphics("Folder/nombre_de_la_imagen.jpgg")
```
Con html se puede ajustar el **porcentaje**
```r
<img src="Folder/nombre_de_la_imagen.jpg" width="20%" />
```
.right[... pero hay muchas otras formas]
---
class: center, middle, inverse
# Ejercicios <svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#FFFFFF;overflow:visible;position:relative;"><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg>
---
## 1.9. Ejercicios
- Instalar y cargar el paquete Xaringan
- Cambiar el YAML
- Cambia tu nombre, y titulo de tu proyecto
- Colocar texto en la dispositiva
- Poner fondo a la diapositiva
- Darle knit
.panelset[
.panel[.panel-name[Instalar]
Instalar paquete
```r
devtools::install_github("yihui/xaringan")
```
]
.panel[.panel-name[YAML]
Cambiar el YAML
```r
output:
xaringan::moon_reader
```
]
.panel[.panel-name[Nombre]
Crea una diapositiva con tu nombre y titulo de tu proyecto.
```r
---
title: "Pingüinos de Adelia"
author: "Miriam Lerma"
date: "Abril 2021"
```
]
.panel[.panel-name[Texto]
Agregar texto
```r
# ¿Son los machos más pesados que las hembras en pingüinos de Adelia?
```
]
.panel[.panel-name[Fondo]
Poner imagen de fondo a las diapositiva<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Unsplash](www.unsplash.com)<br>
[<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#4cc9f0;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg> Imagen pingüino de Adelia](https://images.unsplash.com/flagged/photo-1569491256135-fc0dc118333c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1248&q=80)
```r
---
class: title-slide, center, middle
background-image: url(Elige una imagen)
background-size: cover
```
]
]
---
class: title-slide, inverse, center, middle
# Tablas y Gráficas
<h1>👩🏽🏫📈</h1>
---
name: tablas
## 2.1. Tablas
Para agregar tablas se pueden usar diferentes opciones.
Existen paquetes como:
```r
library(DT)
library(gt)
```
Pero por hoy usaremos **knitr::kable**
Practiquemos con los datos de pinguinos.<br>
Para cargar tus datos:
```r
library(datos)
```
```
## Warning: package 'datos' was built under R version 4.2.3
```
```r
Pingus<-datos::pinguinos
```
---
## 2.1. Tablas
Para crear una la tabla con los pesos de pinguinos de Adelia por sexo
```r
library(tidyverse)
Peso_sexo_Adelia<-Pingus%>%
filter(especie=='Adelia')%>%
group_by(sexo)%>%
summarise(peso=mean(masa_corporal_g))%>%
drop_na()
```
usando knitr::kable
```r
Peso_sexo_Adelia %>%
head()%>%
knitr::kable(format = "html")
```
<table>
<thead>
<tr>
<th style="text-align:left;"> sexo </th>
<th style="text-align:right;"> peso </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> hembra </td>
<td style="text-align:right;"> 3368.836 </td>
</tr>
<tr>
<td style="text-align:left;"> macho </td>
<td style="text-align:right;"> 4043.493 </td>
</tr>
</tbody>
</table>
---
name: graficas
## 2.2. Gráficas
Cuando creamos una gráfica hay que ajustar el tamaño <br>
De lo contrario puede aparecer fuera de limites de la dispositiva.
Por ejemplo:
![](Xaringan-Parte1_files/figure-html/plot01-1.png)<!-- -->
---
## 2.2. Gráficas
Para ajusta el tamaño, hay varias maneras, uno de las maneras es agregar **fig.height** y un valor en el chunk.
```r
#{r, fig.height = 5}
```
Ahora aparece asi.
![](Xaringan-Parte1_files/figure-html/unnamed-chunk-32-1.png)<!-- -->
---
## 2.2. Gráficas
Para ajusta el tamaño, otra manera es especificando **out.width**
Por ejemplo
```r
#{r, out.width="40%"}
```
Ahora aparece así.
<img src="Xaringan-Parte1_files/figure-html/unnamed-chunk-34-1.png" width="40%" />
---
## 2.2. Gráficas
Para no reescribir todo, se puede especificar nombres de los graficos en el chunk.
En un chunk a la **izquierda** se pueden dar las instrucciones, pero no aparecera el gráfico.
```r
#.pull-left[
# ` ` `{r NombreDelPlot, eval=FALSE}
Pingus %>%
filter(especie=='Adelia')%>%
ggplot(aes(x = sexo, y = masa_corporal_g)) +
geom_boxplot(aes(fill = sexo))+
theme_classic()
# ` ` `
# ]
```
Y en un chunk a la **derecha** aparecerá el gráfico pero no las instrucciones.
```r
#.pull-right[
#` ` ` {r NombreDelPlot, ref.label='NombreDelPlot', warning=FALSE,echo=FALSE, out.width="80%"}
# ` ` `
# ]
```
---
## 2.2. Gráficas
Dando este resultado
.pull-left[
```r
Pingus %>%
filter(especie=='Adelia')%>%
ggplot(aes(x = sexo, y = masa_corporal_g)) +
geom_boxplot(aes(fill = sexo))+
theme_classic()
```
]
.pull-right[
<img src="Xaringan-Parte1_files/figure-html/plot05-out-1.png" width="80%" />
]
---
class: center, middle, inverse
# Ejercicios <svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#FFFFFF;overflow:visible;position:relative;"><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg>
---
## 2.3 Ejercicios
- Agregar una tabla <br>
- Crear una figura
.panelset[
.panel[.panel-name[Cargar datos]
No te olvides de cargar primero las librerias
```r
library(tidyverse)
library(datos)
Pingus<-datos::pinguinos
```
]
.panel[.panel-name[Crear tabla]
Para crear una tabla
```r
Peso_sexo_Adelia<-Pingus%>%
filter(especie=='Adelia')%>%
group_by(sexo)%>%
summarise(peso=mean(masa_corporal_g))%>%
drop_na()
```
]
.panel[.panel-name[Agregar tabla]
Agregar tabla
```r
Peso_sexo_Adelia %>%
head()%>%
knitr::kable(format = "html")
```
]
.panel[.panel-name[Figura]
Realizar una figura con estos datos y agregala en las dispositivas.
Ejemplo de figura
```r
Pingus%>%
filter(especie=='Adelia')%>%
ggplot(aes(x = sexo, y = masa_corporal_g)) +
geom_boxplot(aes(fill = sexo))+
theme_classic()
```
]
.panel[.panel-name[Notas]
**Nota**
- Puedes agregar echo=FALSE en el chunk para que no muestre el código
- Puedes agregar warning=FALSE en el chunk para que no muestre los warnings
- Puedes agregar fig.height=5 en el chunk para que ajuste el tamaño de la figura
Si quieres que los contenidos aparezcan lado a lado
1. Pon el codigo para la tabla dentro de . pull - left entre los corchetes
2. Pon el codigo de la figura dentro de .pull - right entre los corchetes
]
]
---
class: inverse
# Recapitulando
Esta clase:
- [Que es Xaringan](#intro)
- [Como agregar fondos](#fondos)
- [Como agregar imagenes](#imagenes)
- [Como agregar tablas](#tablas)
- [Como agregar graficas](#graficas)
.right[
### Contacto
Para dudas, comentarios y sugerencias:<br>
Escríbeme a miriamjlerma@gmail.com
Este material esta accesible y se encuentra en <br>
mi [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg>github](https://github.com/MiriamLL/Curso_CIAD/)
y mi [<svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"/></svg>página](www.miriam-lerma.com)
]
<h1>
.center[
[<svg aria-hidden="true" role="img" viewBox="0 0 576 512" style="height:1em;width:1.12em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#74c69d;overflow:visible;position:relative;"><path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"/></svg> Volver](www.miriam-lerma.com/materiales.html)
]</h1>
</textarea>
<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"highlightLines": true,
"countIncrementalSlides": true
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function(d) {
var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})(document);
(function(d) {
var el = d.getElementsByClassName("remark-slides-area");
if (!el) return;
var slide, slides = slideshow.getSlides(), els = el[0].children;
for (var i = 1; i < slides.length; i++) {
slide = slides[i];
if (slide.properties.continued === "true" || slide.properties.count === "false") {
els[i - 1].className += ' has-continuation';
}
}
var s = d.createElement("style");
s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
d.head.appendChild(s);
})(document);
// delete the temporary CSS (for displaying all slides initially) when the user
// starts to view slides
(function() {
var deleted = false;
slideshow.on('beforeShowSlide', function(slide) {
if (deleted) return;
var sheets = document.styleSheets, node;
for (var i = 0; i < sheets.length; i++) {
node = sheets[i].ownerNode;
if (node.dataset["target"] !== "print-only") continue;
node.parentNode.removeChild(node);
}
deleted = true;
});
})();
// add `data-at-shortcutkeys` attribute to <body> to resolve conflicts with JAWS
// screen reader (see PR #262)
(function(d) {
let res = {};
d.querySelectorAll('.remark-help-content table tr').forEach(tr => {
const t = tr.querySelector('td:nth-child(2)').innerText;
tr.querySelectorAll('td:first-child .key').forEach(key => {
const k = key.innerText;
if (/^[a-z]$/.test(k)) res[k] = t; // must be a single letter (key)
});
});
d.body.setAttribute('data-at-shortcutkeys', JSON.stringify(res));
})(document);
(function() {
"use strict"
// Replace <script> tags in slides area to make them executable
var scripts = document.querySelectorAll(
'.remark-slides-area .remark-slide-container script'
);
if (!scripts.length) return;
for (var i = 0; i < scripts.length; i++) {
var s = document.createElement('script');
var code = document.createTextNode(scripts[i].textContent);
s.appendChild(code);
var scriptAttrs = scripts[i].attributes;
for (var j = 0; j < scriptAttrs.length; j++) {
s.setAttribute(scriptAttrs[j].name, scriptAttrs[j].value);
}
scripts[i].parentElement.replaceChild(s, scripts[i]);
}
})();
(function() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
links[i].target = '_blank';
}
}
})();
// adds .remark-code-has-line-highlighted class to <pre> parent elements
// of code chunks containing highlighted lines with class .remark-code-line-highlighted
(function(d) {
const hlines = d.querySelectorAll('.remark-code-line-highlighted');
const preParents = [];
const findPreParent = function(line, p = 0) {
if (p > 1) return null; // traverse up no further than grandparent
const el = line.parentElement;
return el.tagName === "PRE" ? el : findPreParent(el, ++p);
};
for (let line of hlines) {
let pre = findPreParent(line);
if (pre && !preParents.includes(pre)) preParents.push(pre);
}
preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
})(document);</script>
<script>
slideshow._releaseMath = function(el) {
var i, text, code, codes = el.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
};
slideshow._releaseMath(document);
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>