Skip to content

Commit

Permalink
wordcloud html
Browse files Browse the repository at this point in the history
  • Loading branch information
dadosdelaplace committed Jan 29, 2022
1 parent a514fae commit f95cd63
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 55 deletions.
Binary file modified .DS_Store
Binary file not shown.
18 changes: 15 additions & 3 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4955,7 +4955,7 @@ knitr::include_graphics("./img/semaforo.jpg")

.pull-left[

```{r echo = FALSE, out.width = "100%", fig.align = "center", fig.cap = "Imagen extraída de Reddit"}
```{r echo = FALSE, out.width = "70%", fig.align = "center", fig.cap = "Imagen extraída de Reddit"}
knitr::include_graphics("https://dadosdelaplace.github.io/courses-ECI-2022/img/telling-dataviz")
```

Expand Down Expand Up @@ -6771,7 +6771,7 @@ starwars %>% drop_na(mass, height) %>%

# Volvemos a ggplot: diagrama de barras

Vamos a visualizar en un **diagrama de barras* la **variable cualitativa** `species`, calculando primero el número de personajes de cada especie con `count()` (filtrando primero los ausentes).
Vamos a visualizar en un **diagrama de barras** la **variable cualitativa** `species`, calculando primero el número de personajes de cada especie con `count()` (filtrando primero los ausentes).

```{r}
starwars %>%
Expand Down Expand Up @@ -6934,7 +6934,7 @@ fct_lump_min(estado_fct, min = 5, other_level = "otros")

.pull-left[

Vamos a repetir el diagrama de barras anterior pero indicándole que nos convierta `species`* a factor, y que nos **agrupe aquellas niveles que tengan menos de 2 personajes**.
Vamos a repetir el diagrama de barras anterior pero indicándole que nos convierta `species` a **factor**, y que nos **agrupe aquellas niveles que tengan menos de 2 personajes**.

```{r eval = FALSE}
ggplot(starwars %>%
Expand Down Expand Up @@ -6994,6 +6994,18 @@ wordcloud2(starwars %>% drop_na(species) %>%

.pull-right[

```{r echo = FALSE, out.width = 65%}
library(wordcloud2)
gg <-
wordcloud2(starwars %>% drop_na(species) %>%
mutate(species =
fct_lump_min(species, min = 2,
other_level = "otras")) %>%
count(species),
size = 0.8, color= 'random-dark')
htmltools::tagList(list(gg))
```


]

Expand Down
111 changes: 59 additions & 52 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<script src="libs/dt-core/js/jquery.dataTables.min.js"></script>
<link href="libs/crosstalk/css/crosstalk.css" rel="stylesheet" />
<script src="libs/crosstalk/js/crosstalk.min.js"></script>
<link href="libs/wordcloud2/wordcloud.css" rel="stylesheet" />
<script src="libs/wordcloud2/wordcloud2-all.js"></script>
<script src="libs/wordcloud2/hover.js"></script>
<script src="libs/wordcloud2-binding/wordcloud2.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
Expand Down Expand Up @@ -4006,8 +4010,8 @@
# Listado de paquetes útiles usados (en manual o diapos)


<div id="htmlwidget-7c24f5861cf0288f4d77" style="width:100%;height:auto;" class="datatables html-widget"></div>
<script type="application/json" data-for="htmlwidget-7c24f5861cf0288f4d77">{"x":{"filter":"none","caption":"<caption>Tabla (editable en cada celda)<\/caption>","editable":{"target":"cell","disable":{"columns":null}},"data":[["glue, stringr","tibble, tidyr, dplyr","readr, readxl, rvest","purrr","ggplot2","lubridate","rmarkdown, knitr","DT","xaringan","microbenchmark","devtools","eurostat","gapminder","datasets","owidR","ropenspain/climaemet","ropenspain/infoelectoral","JaseZiv/chessR"],["Manejo de textos","Manejo de datos (tidyverse)","Importación de archivos (tidyverse)","Manejo de listas (tidyverse)","Dataviz (tidyverse)","Manejo de fechas (tidyverse)","Generación de informes/docs","Tablas interactivas en .Rmd","Generación de diapositivas","Comparación de tiempos","Instalar paquetes desde Github","Datos del Eurostat","Datos socioeconómicos de países","Paquete con datos","Datos de Our World in Data","Datos del AEMET","Datos electorales (España)","Datos de partidas de ajedrez"]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Paquete<\/th>\n <th>Detalles<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"pageLength":8,"hover":true,"order":[],"autoWidth":false,"orderClasses":false,"lengthMenu":[8,10,25,50,100],"rowCallback":"function(row, data, displayNum, displayIndex, dataIndex) {\nvar value=data[0]; $(row).css({'background-color':'white'});\nvar value=data[1]; $(row).css({'background-color':'white'});\n}"}},"evals":["options.rowCallback"],"jsHooks":[]}</script>
<div id="htmlwidget-d0450ab285ec661b7871" style="width:100%;height:auto;" class="datatables html-widget"></div>
<script type="application/json" data-for="htmlwidget-d0450ab285ec661b7871">{"x":{"filter":"none","caption":"<caption>Tabla (editable en cada celda)<\/caption>","editable":{"target":"cell","disable":{"columns":null}},"data":[["glue, stringr","tibble, tidyr, dplyr","readr, readxl, rvest","purrr","ggplot2","lubridate","rmarkdown, knitr","DT","xaringan","microbenchmark","devtools","eurostat","gapminder","datasets","owidR","ropenspain/climaemet","ropenspain/infoelectoral","JaseZiv/chessR"],["Manejo de textos","Manejo de datos (tidyverse)","Importación de archivos (tidyverse)","Manejo de listas (tidyverse)","Dataviz (tidyverse)","Manejo de fechas (tidyverse)","Generación de informes/docs","Tablas interactivas en .Rmd","Generación de diapositivas","Comparación de tiempos","Instalar paquetes desde Github","Datos del Eurostat","Datos socioeconómicos de países","Paquete con datos","Datos de Our World in Data","Datos del AEMET","Datos electorales (España)","Datos de partidas de ajedrez"]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Paquete<\/th>\n <th>Detalles<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"pageLength":8,"hover":true,"order":[],"autoWidth":false,"orderClasses":false,"lengthMenu":[8,10,25,50,100],"rowCallback":"function(row, data, displayNum, displayIndex, dataIndex) {\nvar value=data[0]; $(row).css({'background-color':'white'});\nvar value=data[1]; $(row).css({'background-color':'white'});\n}"}},"evals":["options.rowCallback"],"jsHooks":[]}</script>


---
Expand Down Expand Up @@ -5487,11 +5491,11 @@

```
&gt; # A tibble: 3 × 14
&gt; name height mass hair_color skin_color eye_color birth_year sex gender
&gt; &lt;chr&gt; &lt;int&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt;
&gt; 1 Biggs D183 84 black light brown 24 male mascu…
&gt; 2 Sly Moo… 178 48 none pale white NA &lt;NA&gt; &lt;NA&gt;
&gt; 3 Barriss… 166 50 black yellow blue 40 female femin
&gt; name height mass hair_color skin_color eye_color birth_year sex gender
&gt; &lt;chr&gt; &lt;int&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt;
&gt; 1 Ben Qu163 65 none grey, gree… orange NA male mascu…
&gt; 2 Owen L… 178 120 brown, grey light blue 52 male mascu…
&gt; 3 Tarfful 234 136 brown brown blue NA male mascu
&gt; # … with 5 more variables: homeworld &lt;chr&gt;, species &lt;chr&gt;, films &lt;list&gt;,
&gt; # vehicles &lt;list&gt;, starships &lt;list&gt;
```
Expand All @@ -5502,11 +5506,11 @@

```
&gt; # A tibble: 3 × 14
&gt; name height mass hair_color skin_color eye_color birth_year sex gender
&gt; &lt;chr&gt; &lt;int&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt;
&gt; 1 Tarfful 234 136 brown brown blue NA male mascul
&gt; 2 Mas Ame196 NA none blue blue NA male mascul
&gt; 3 Barriss166 50 black yellow blue 40 fema… femini
&gt; name height mass hair_color skin_color eye_color birth_year sex gender
&gt; &lt;chr&gt; &lt;int&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt;
&gt; 1 Bossk 190 113 none green red 53 male mascu
&gt; 2 Wilhuff180 NA auburn, gr… fair blue 64 male mascu
&gt; 3 Darth V202 136 none white yellow 41.9 male mascu
&gt; # … with 5 more variables: homeworld &lt;chr&gt;, species &lt;chr&gt;, films &lt;list&gt;,
&gt; # vehicles &lt;list&gt;, starships &lt;list&gt;
```
Expand Down Expand Up @@ -7825,7 +7829,7 @@
.pull-left[

&lt;div class="figure" style="text-align: center"&gt;
&lt;img src="https://dadosdelaplace.github.io/courses-ECI-2022/img/telling-dataviz" alt="Imagen extraída de Reddit" width="100%" /&gt;
&lt;img src="https://dadosdelaplace.github.io/courses-ECI-2022/img/telling-dataviz" alt="Imagen extraída de Reddit" width="70%" /&gt;
&lt;p class="caption"&gt;Imagen extraída de Reddit&lt;/p&gt;
&lt;/div&gt;

Expand Down Expand Up @@ -9461,16 +9465,16 @@
&gt; # A tibble: 50 × 3
&gt; mates lengua dibujo
&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt;
&gt; 1 3 2 6
&gt; 2 9 7 3
&gt; 3 8 7 9
&gt; 4 5 8 2
&gt; 5 8 9 6
&gt; 6 3 4 5
&gt; 7 2 8 0
&gt; 8 5 0 7
&gt; 9 2 6 3
&gt; 10 1 9 7
&gt; 1 10 5 4
&gt; 2 9 6 1
&gt; 3 9 7 5
&gt; 4 1 6 3
&gt; 5 6 4 4
&gt; 6 2 5 2
&gt; 7 0 0 5
&gt; 8 10 1 4
&gt; 9 5 3 1
&gt; 10 8 3 5
&gt; # … with 40 more rows
```

Expand All @@ -9490,16 +9494,16 @@
&gt; # A tibble: 50 × 4
&gt; mates lengua dibujo media_curso
&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt;
&gt; 1 3 2 6 5.24
&gt; 2 9 7 3 5.24
&gt; 3 8 7 9 5.24
&gt; 4 5 8 2 5.24
&gt; 5 8 9 6 5.24
&gt; 6 3 4 5 5.24
&gt; 7 2 8 0 5.24
&gt; 8 5 0 7 5.24
&gt; 9 2 6 3 5.24
&gt; 10 1 9 7 5.24
&gt; 1 10 5 4 4.8
&gt; 2 9 6 1 4.8
&gt; 3 9 7 5 4.8
&gt; 4 1 6 3 4.8
&gt; 5 6 4 4 4.8
&gt; 6 2 5 2 4.8
&gt; 7 0 0 5 4.8
&gt; 8 10 1 4 4.8
&gt; 9 5 3 1 4.8
&gt; 10 8 3 5 4.8
&gt; # … with 40 more rows
```

Expand All @@ -9523,16 +9527,16 @@
&gt; # Rowwise:
&gt; mates lengua dibujo media_curso
&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt;
&gt; 1 3 2 6 3.67
&gt; 2 9 7 3 6.33
&gt; 3 8 7 9 8
&gt; 4 5 8 2 5
&gt; 5 8 9 6 7.67
&gt; 6 3 4 5 4
&gt; 7 2 8 0 3.33
&gt; 8 5 0 7 4
&gt; 9 2 6 3 3.67
&gt; 10 1 9 7 5.67
&gt; 1 10 5 4 6.33
&gt; 2 9 6 1 5.33
&gt; 3 9 7 5 7
&gt; 4 1 6 3 3.33
&gt; 5 6 4 4 4.67
&gt; 6 2 5 2 3
&gt; 7 0 0 5 1.67
&gt; 8 10 1 4 5
&gt; 9 5 3 1 3
&gt; 10 8 3 5 5.33
&gt; # … with 40 more rows
```

Expand Down Expand Up @@ -9683,7 +9687,7 @@

# Volvemos a ggplot: diagrama de barras

Vamos a visualizar en un **diagrama de barras* la **variable cualitativa** `species`, calculando primero el número de personajes de cada especie con `count()` (filtrando primero los ausentes).
Vamos a visualizar en un **diagrama de barras** la **variable cualitativa** `species`, calculando primero el número de personajes de cada especie con `count()` (filtrando primero los ausentes).


```r
Expand Down Expand Up @@ -9914,7 +9918,7 @@

.pull-left[

Vamos a repetir el diagrama de barras anterior pero indicándole que nos convierta `species`* a factor, y que nos **agrupe aquellas niveles que tengan menos de 2 personajes**.
Vamos a repetir el diagrama de barras anterior pero indicándole que nos convierta `species` a **factor**, y que nos **agrupe aquellas niveles que tengan menos de 2 personajes**.


```r
Expand Down Expand Up @@ -9963,6 +9967,9 @@

.pull-right[

<div id="htmlwidget-3655b379f580523afcea" style="width:960px;height:500px;" class="wordcloud2 html-widget"></div>
<script type="application/json" data-for="htmlwidget-3655b379f580523afcea">{"x":{"word":["Droid","Gungan","Human","Kaminoan","Mirialan","Twi'lek","Wookiee","Zabrak","otras"],"freq":[6,3,35,2,2,2,2,2,29],"fontFamily":"Segoe UI","fontWeight":"bold","color":"random-dark","minSize":0,"weightFactor":4.11428571428571,"backgroundColor":"white","gridSize":0,"minRotation":-0.785398163397448,"maxRotation":0.785398163397448,"shuffle":true,"rotateRatio":0.4,"shape":"circle","ellipticity":0.65,"figBase64":null,"hover":null},"evals":[],"jsHooks":{"render":[{"code":"function(el,x){\n console.log(123);\n if(!iii){\n window.location.reload();\n iii = False;\n\n }\n }","data":null}]}}</script>


]

Expand Down Expand Up @@ -9995,7 +10002,7 @@
.pull-right[


&lt;img src="index_files/figure-html/unnamed-chunk-430-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-431-1.png" width="100%" /&gt;

]

Expand Down Expand Up @@ -10030,7 +10037,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-432-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-433-1.png" width="100%" /&gt;

]

Expand Down Expand Up @@ -10070,7 +10077,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-434-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-435-1.png" width="100%" /&gt;

]

Expand Down Expand Up @@ -10124,7 +10131,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-437-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-438-1.png" width="100%" /&gt;

]

Expand All @@ -10147,7 +10154,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-439-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-440-1.png" width="100%" /&gt;

]
]
Expand All @@ -10169,7 +10176,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-441-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-442-1.png" width="100%" /&gt;

]

Expand Down Expand Up @@ -10200,7 +10207,7 @@

.pull-right[

&lt;img src="index_files/figure-html/unnamed-chunk-443-1.png" width="100%" /&gt;
&lt;img src="index_files/figure-html/unnamed-chunk-444-1.png" width="100%" /&gt;

]

Expand Down

0 comments on commit f95cd63

Please sign in to comment.