class: center, middle, inverse, title-slide # Visualización de datos ## Taller R Octubre 29 ### Anabelle Laurent --- # ¡Hola! 😄 -- En esta charla vamos a aprender como visualizar datos con ggplot2 <center><img src="images/ggplot2logo.png" style="width: 25%" /> </center> --- ### ¿ Porque la visualización de datos es importante ? -- - Manera universal de **comunicar** información - Dar un **mensaje claro y eficaz**. - Encuentra **patrones, tendencias, detecta valores extremos**. - Haga que los datos sean memorables - Mantener el interés de la audiencia --- ### ¿Qué hace una buena visualización? 🤔 -- - Revela una **tendencia** o **relación** entre variables - Siempre tenga como mínimo un **título**, **eje**, **escalas** y **símbolos** - Símbolos distintos y legibles (es decir, use contraste) - El título debe transmitir la mayor cantidad de información posible - Sin ruido: mantenga la información al mínimo - el **tipo de gráfico correcto** según el tipo de datos que se presentarán --- class: inverse, middle, center # Primero: ¿ que es ggplot2 ? 🤔 --- <center><img src="images/ggplot2_masterpiece.png" style="width: 80%" /> </center> [Artwork by @allison_horst](https://github.com/allisonhorst/stats-illustrations) --- <center><img src="images/tidyverse_espanol.png" style="width: 80%" /> </center> Ayuda para todo el processo de ciencia de datos. Hoy vamos a explotar **ggplot2** que ayuda para la visualización de datos. --- class: inverse, middle, center # Primero, hacemos un grafico basico --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r *paises ``` ] .panel2-ggplotex1-auto[ ``` # A tibble: 1,704 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Afganistán Asia 1952 28.8 8425333 779. 2 Afganistán Asia 1957 30.3 9240934 821. 3 Afganistán Asia 1962 32.0 10267083 853. 4 Afganistán Asia 1967 34.0 11537966 836. 5 Afganistán Asia 1972 36.1 13079460 740. 6 Afganistán Asia 1977 38.4 14880372 786. 7 Afganistán Asia 1982 39.9 12881816 978. 8 Afganistán Asia 1987 40.8 13867957 852. 9 Afganistán Asia 1992 41.7 16317921 649. 10 Afganistán Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% * ggplot() ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_02_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% ggplot() + * aes(x = anio) ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_03_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% ggplot() + aes(x = anio) + * aes(y = esperanza_de_vida) ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_04_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% ggplot() + aes(x = anio) + aes(y = esperanza_de_vida) + * geom_point() ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_05_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% ggplot() + aes(x = anio) + aes(y = esperanza_de_vida) + geom_point() + * xlab("Anio") ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_06_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex1-auto[ ```r paises %>% ggplot() + aes(x = anio) + aes(y = esperanza_de_vida) + geom_point() + xlab("Anio") + * ylab("Esperanza de vida") ``` ] .panel2-ggplotex1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex1_auto_07_output-1.png)<!-- --> ] <style> .panel1-ggplotex1-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-ggplotex1-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-ggplotex1-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r *paises ``` ] .panel2-ggplotex2-auto[ ``` # A tibble: 1,704 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Afganistán Asia 1952 28.8 8425333 779. 2 Afganistán Asia 1957 30.3 9240934 821. 3 Afganistán Asia 1962 32.0 10267083 853. 4 Afganistán Asia 1967 34.0 11537966 836. 5 Afganistán Asia 1972 36.1 13079460 740. 6 Afganistán Asia 1977 38.4 14880372 786. 7 Afganistán Asia 1982 39.9 12881816 978. 8 Afganistán Asia 1987 40.8 13867957 852. 9 Afganistán Asia 1992 41.7 16317921 649. 10 Afganistán Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r paises %>% * filter(pais=="Ecuador") ``` ] .panel2-ggplotex2-auto[ ``` # A tibble: 12 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Ecuador Américas 1952 48.4 3548753 3522. 2 Ecuador Américas 1957 51.4 4058385 3781. 3 Ecuador Américas 1962 54.6 4681707 4086. 4 Ecuador Américas 1967 56.7 5432424 4579. 5 Ecuador Américas 1972 58.8 6298651 5281. 6 Ecuador Américas 1977 61.3 7278866 6680. 7 Ecuador Américas 1982 64.3 8365850 7214. 8 Ecuador Américas 1987 67.2 9545158 6482. 9 Ecuador Américas 1992 69.6 10748394 7104. 10 Ecuador Américas 1997 72.3 11911819 7429. 11 Ecuador Américas 2002 74.2 12921234 5773. 12 Ecuador Américas 2007 75.0 13755680 6873. ``` ] --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r paises %>% filter(pais=="Ecuador") %>% * ggplot(aes(x=anio, * y=esperanza_de_vida)) ``` ] .panel2-ggplotex2-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex2_auto_03_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r paises %>% filter(pais=="Ecuador") %>% ggplot(aes(x=anio, y=esperanza_de_vida)) + * geom_line(color="blue") ``` ] .panel2-ggplotex2-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex2_auto_04_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r paises %>% filter(pais=="Ecuador") %>% ggplot(aes(x=anio, y=esperanza_de_vida)) + geom_line(color="blue") + * xlab("Anio") ``` ] .panel2-ggplotex2-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex2_auto_05_output-1.png)<!-- --> ] --- count: false Gráfico básico .panel1-ggplotex2-auto[ ```r paises %>% filter(pais=="Ecuador") %>% ggplot(aes(x=anio, y=esperanza_de_vida)) + geom_line(color="blue") + xlab("Anio") + * ylab("Esperanza de vida") ``` ] .panel2-ggplotex2-auto[ ![](ggplot2_TallerR_easy_files/figure-html/ggplotex2_auto_06_output-1.png)<!-- --> ] <style> .panel1-ggplotex2-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-ggplotex2-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-ggplotex2-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> Los mapeos estéticos pueden hacer parte de 'ggplot(...)' --- ```r paises %>% # llama los datos y usamos la tuberia %>% ggplot(aes(x=anio, y=esperanza_de_vida)) + # mapeos estéticos y añade capas elementos con + geom_line(color="blue") + # Usa una geom para representar los datos xlab("Anio") + # titulo del eje x ylab("Esperanza de vida") # titulo del eje y ``` - Datos: siempre una tabla. - mapeos estéticos asocian los elementos representables gráficamente (la posición x e y que son dos columnas de la tabla de datos) - capas geometrías (geom): puntos, rectas, histogramas, densidades, etc. También se llaman capas porque pueden superponerse. - siempre usa el elemento "+" par añadir capas con ggplot (que no se confunden con la tuberia %>%) --- ## Los datos que vamos a usar ```r install.packages("datos") library(datos) paises library(carData) salary <- carData::Salaries ``` --- ```r head(paises, n =10) # muestra las "n" primeras lineas de datos ``` ``` # A tibble: 10 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Afganistán Asia 1952 28.8 8425333 779. 2 Afganistán Asia 1957 30.3 9240934 821. 3 Afganistán Asia 1962 32.0 10267083 853. 4 Afganistán Asia 1967 34.0 11537966 836. 5 Afganistán Asia 1972 36.1 13079460 740. 6 Afganistán Asia 1977 38.4 14880372 786. 7 Afganistán Asia 1982 39.9 12881816 978. 8 Afganistán Asia 1987 40.8 13867957 852. 9 Afganistán Asia 1992 41.7 16317921 649. 10 Afganistán Asia 1997 41.8 22227415 635. ``` --- ```r head(salary, n =10) # muestra las "n" primeras lineas de datos ``` ``` rank discipline yrs.since.phd yrs.service sex salary 1 Prof B 19 18 Male 139750 2 Prof B 20 16 Male 173200 3 AsstProf B 4 3 Male 79750 4 Prof B 45 39 Male 115000 5 Prof B 40 41 Male 141500 6 AssocProf B 6 6 Male 97000 7 Prof B 30 23 Male 175000 8 Prof B 45 45 Male 147765 9 Prof B 21 20 Male 119250 10 Prof B 18 18 Female 129000 ``` rank = rango displicine = disciplina yrs.since.phd = años desde el doctorado yrs.service = años de servicio sex = sexo salary = salario --- ```r salarios <- salary %>% rename(rango =rank, # cambiar nombre de los variables disciplina = discipline, anio.desde.phd = yrs.since.phd, anio.servicio = yrs.service, sexo = sex, salario = salary) %>% mutate(rango=recode(rango, # cambiar los niveles AsstProf="Profesor(a) asistente", AssocProf="Profesor(a) asociada", Prof= "Professor(a)")) head(salarios,n=5) ``` ``` rango disciplina anio.desde.phd anio.servicio sexo salario 1 Professor(a) B 19 18 Male 139750 2 Professor(a) B 20 16 Male 173200 3 Profesor(a) asistente B 4 3 Male 79750 4 Professor(a) B 45 39 Male 115000 5 Professor(a) B 40 41 Male 141500 ``` --- class: inverse, center, middle # Visualizar una cantidad --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r *salarios ``` ] .panel2-barplot1-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% * ggplot(aes(x=rango)) ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_02_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% ggplot(aes(x=rango)) + * geom_bar(stat = "count") # por defecto ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_03_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% ggplot(aes(x=rango)) + geom_bar(stat = "count") + # por defecto * theme_bw() ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_04_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% ggplot(aes(x=rango)) + geom_bar(stat = "count") + # por defecto theme_bw() + * xlab("Rango") ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_05_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% ggplot(aes(x=rango)) + geom_bar(stat = "count") + # por defecto theme_bw() + xlab("Rango") + * coord_flip() ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_06_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_bar() .panel1-barplot1-auto[ ```r salarios %>% ggplot(aes(x=rango)) + geom_bar(stat = "count") + # por defecto theme_bw() + xlab("Rango") + coord_flip() + * theme(axis.text=element_text(size=16), * axis.title=element_text(size=16, * face="bold"), * axis.text.x=element_text(angle = 45, * hjust = 1)) ``` ] .panel2-barplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/barplot1_auto_07_output-1.png)<!-- --> ] <style> .panel1-barplot1-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-barplot1-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-barplot1-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- Este grafico **representa el número de casos en cada grupo**. Usa 'coord_flip' para voltear las coordenadas cartesianas para que la horizontal se convierta en vertical y la vertical en horizontal --- ```r salarios %>% ggplot(aes(x = rango,y=salario)) + geom_bar(), # la altura de la barra = número de casos en cada grupo + theme_bw() + # fondo blanco xlab("Rango") + theme(axis.text=element_text(size=16), # tamaño de las etiquetas axis.title =element_text(size=16, # tamaño del titulo de los ejes face="bold"), # texto en negrita axis.text.x = element_text(angle = 45, hjust = 1)) + # ángulo de 45% para el eje x coord_flip() # voltear las coordenadas ``` --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r *paises ``` ] .panel2-dotplot1-auto[ ``` # A tibble: 1,704 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Afganistán Asia 1952 28.8 8425333 779. 2 Afganistán Asia 1957 30.3 9240934 821. 3 Afganistán Asia 1962 32.0 10267083 853. 4 Afganistán Asia 1967 34.0 11537966 836. 5 Afganistán Asia 1972 36.1 13079460 740. 6 Afganistán Asia 1977 38.4 14880372 786. 7 Afganistán Asia 1982 39.9 12881816 978. 8 Afganistán Asia 1987 40.8 13867957 852. 9 Afganistán Asia 1992 41.7 16317921 649. 10 Afganistán Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% * filter(anio==2002 & continente== "Europa") ``` ] .panel2-dotplot1-auto[ ``` # A tibble: 30 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Albania Europa 2002 75.7 3508512 4604. 2 Austria Europa 2002 79.0 8148312 32418. 3 Bélgica Europa 2002 78.3 10311970 30486. 4 Bosnia y Herzegovina Europa 2002 74.1 4165416 6019. 5 Bulgaria Europa 2002 72.1 7661799 7697. 6 Croacia Europa 2002 74.9 4481020 11628. 7 República Checa Europa 2002 75.5 10256295 17596. 8 Dinamarca Europa 2002 77.2 5374693 32167. 9 Finlandia Europa 2002 78.4 5193039 28205. 10 Francia Europa 2002 79.6 59925035 28926. # … with 20 more rows ``` ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% * ggplot(aes(x = pais, * y = esperanza_de_vida)) ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_03_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + * geom_point(col="steelblue",size=3) ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_04_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + * coord_flip() ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_05_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + * theme_bw() ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_06_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + * xlab("") ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_07_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + * ylab("Esperanza de vida") ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_08_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + ylab("Esperanza de vida") + * theme(axis.text.x = element_text(angle = 90, * hjust = 1), * axis.text=element_text(size=14), * axis.title =element_text(size=14)) ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_09_output-1.png)<!-- --> ] --- count: false Visualizar una cantidad con geom_point() .panel1-dotplot1-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x = pais, y = esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + ylab("Esperanza de vida") + theme(axis.text.x = element_text(angle = 90, hjust = 1), axis.text=element_text(size=14), axis.title =element_text(size=14)) + * labs(title="Esperanza de vida en 2002", * subtitle = "Ejemplo para Europa") ``` ] .panel2-dotplot1-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot1_auto_10_output-1.png)<!-- --> ] <style> .panel1-dotplot1-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-dotplot1-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-dotplot1-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r *paises ``` ] .panel2-dotplot_reorder-auto[ ``` # A tibble: 1,704 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Afganistán Asia 1952 28.8 8425333 779. 2 Afganistán Asia 1957 30.3 9240934 821. 3 Afganistán Asia 1962 32.0 10267083 853. 4 Afganistán Asia 1967 34.0 11537966 836. 5 Afganistán Asia 1972 36.1 13079460 740. 6 Afganistán Asia 1977 38.4 14880372 786. 7 Afganistán Asia 1982 39.9 12881816 978. 8 Afganistán Asia 1987 40.8 13867957 852. 9 Afganistán Asia 1992 41.7 16317921 649. 10 Afganistán Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% * filter(anio==2002 & continente== "Europa") ``` ] .panel2-dotplot_reorder-auto[ ``` # A tibble: 30 × 6 pais continente anio esperanza_de_vida poblacion pib_per_capita <fct> <fct> <int> <dbl> <int> <dbl> 1 Albania Europa 2002 75.7 3508512 4604. 2 Austria Europa 2002 79.0 8148312 32418. 3 Bélgica Europa 2002 78.3 10311970 30486. 4 Bosnia y Herzegovina Europa 2002 74.1 4165416 6019. 5 Bulgaria Europa 2002 72.1 7661799 7697. 6 Croacia Europa 2002 74.9 4481020 11628. 7 República Checa Europa 2002 75.5 10256295 17596. 8 Dinamarca Europa 2002 77.2 5374693 32167. 9 Finlandia Europa 2002 78.4 5193039 28205. 10 Francia Europa 2002 79.6 59925035 28926. # … with 20 more rows ``` ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% * ggplot(aes(x=reorder(pais,esperanza_de_vida), * y=esperanza_de_vida)) ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_03_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + * geom_point(col="steelblue",size=3) ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_04_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + * coord_flip() ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_05_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + * theme_bw() ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_06_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + * xlab("") ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_07_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + * ylab("Esperanza de vida") ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_08_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + ylab("Esperanza de vida") + * theme(axis.text.x = element_text(angle = 90, * hjust = 1), * axis.text=element_text(size=14), * axis.title =element_text(size=14)) ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_09_output-1.png)<!-- --> ] --- count: false Ordenar los niveles de una variable .panel1-dotplot_reorder-auto[ ```r paises %>% filter(anio==2002 & continente== "Europa") %>% ggplot(aes(x=reorder(pais,esperanza_de_vida), y=esperanza_de_vida)) + geom_point(col="steelblue",size=3) + coord_flip() + theme_bw() + xlab("") + ylab("Esperanza de vida") + theme(axis.text.x = element_text(angle = 90, hjust = 1), axis.text=element_text(size=14), axis.title =element_text(size=14)) + * labs(title="Esperanza de vida en 2002", * subtitle = "Ejemplo para Europa") ``` ] .panel2-dotplot_reorder-auto[ ![](ggplot2_TallerR_easy_files/figure-html/dotplot_reorder_auto_10_output-1.png)<!-- --> ] <style> .panel1-dotplot_reorder-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-dotplot_reorder-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-dotplot_reorder-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- 'reorder' para **reordenar** los niveles de la variable pais basándose en los valores de la variable esperanza_de_vida --- class: inverse, center, middle # Visualizar una distribución <center><img src="images/histogram.png" style="width: 70%" /> </center> [Artwork by @allison_horst](https://github.com/allisonhorst/stats-illustrations) --- count: false Visualizar una distribución con geom_histogram() .panel1-hist_bin-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_histogram(binwidth = 1) + theme_bw() + xlab("Esperanza de vida")+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-hist_bin-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/hist_bin_rotate_01_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_histogram() .panel1-hist_bin-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_histogram(binwidth = 5) + theme_bw() + xlab("Esperanza de vida")+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-hist_bin-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/hist_bin_rotate_02_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_histogram() .panel1-hist_bin-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_histogram(binwidth = 10) + theme_bw() + xlab("Esperanza de vida")+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-hist_bin-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/hist_bin_rotate_03_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_histogram() .panel1-hist_bin-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_histogram(binwidth = 20) + theme_bw() + xlab("Esperanza de vida")+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-hist_bin-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/hist_bin_rotate_04_output-1.png)<!-- --> ] <style> .panel1-hist_bin-rotate { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-hist_bin-rotate { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-hist_bin-rotate { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> Usa **binwidth** para el ancho de los contenedores. --- count: false Visualizar una distribución con geom_density() .panel1-densityplot-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_density(bw = 1) + theme_bw() + xlab("Esperanza de vida") + xlim(20,90)+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-densityplot-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/densityplot_rotate_01_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_density() .panel1-densityplot-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_density(bw = 5) + theme_bw() + xlab("Esperanza de vida") + xlim(20,90)+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-densityplot-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/densityplot_rotate_02_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_density() .panel1-densityplot-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_density(bw = 10) + theme_bw() + xlab("Esperanza de vida") + xlim(20,90)+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-densityplot-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/densityplot_rotate_03_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con geom_density() .panel1-densityplot-rotate[ ```r paises %>% ggplot(aes(x = esperanza_de_vida)) + * geom_density(bw = 20) + theme_bw() + xlab("Esperanza de vida") + xlim(20,90)+ theme(axis.text=element_text(size=16), axis.title =element_text(size=16, face="bold"), legend.text=element_text(size=16)) ``` ] .panel2-densityplot-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/densityplot_rotate_04_output-1.png)<!-- --> ] <style> .panel1-densityplot-rotate { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-densityplot-rotate { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-densityplot-rotate { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- ### Visualizar una distribución con un diagrama de caja <center><img src="images/diagrama_caja.png" style="width: 40%" /> </center> --- count: false Visualizar una distribución con un diagrama de caja (geom_boxplot) .panel1-boxplot-auto[ ```r *salarios ``` ] .panel2-boxplot-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Visualizar una distribución con un diagrama de caja (geom_boxplot) .panel1-boxplot-auto[ ```r salarios %>% * ggplot(aes(rango, salario)) ``` ] .panel2-boxplot-auto[ ![](ggplot2_TallerR_easy_files/figure-html/boxplot_auto_02_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con un diagrama de caja (geom_boxplot) .panel1-boxplot-auto[ ```r salarios %>% ggplot(aes(rango, salario)) + * geom_boxplot() ``` ] .panel2-boxplot-auto[ ![](ggplot2_TallerR_easy_files/figure-html/boxplot_auto_03_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con un diagrama de caja (geom_boxplot) .panel1-boxplot-auto[ ```r salarios %>% ggplot(aes(rango, salario)) + geom_boxplot() + * geom_jitter(col="darkgrey") ``` ] .panel2-boxplot-auto[ ![](ggplot2_TallerR_easy_files/figure-html/boxplot_auto_04_output-1.png)<!-- --> ] --- count: false Visualizar una distribución con un diagrama de caja (geom_boxplot) .panel1-boxplot-auto[ ```r salarios %>% ggplot(aes(rango, salario)) + geom_boxplot() + geom_jitter(col="darkgrey") + * theme_bw() ``` ] .panel2-boxplot-auto[ ![](ggplot2_TallerR_easy_files/figure-html/boxplot_auto_05_output-1.png)<!-- --> ] <style> .panel1-boxplot-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-boxplot-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-boxplot-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- Los diagramas de caja con "jitter" informan sobre: - la distribución de los datos - si los grupos están equilibrados o desequilibrados (nombre de observaciones) --- class: inverse, center, middle # Visualizar dos variables numéricas --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r *salarios ``` ] .panel2-geompoint-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% * ggplot(aes(x = anio.desde.phd, * y = salario)) ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_02_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + * geom_point() ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_03_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ * theme(legend.position = "none") ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_04_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ theme(legend.position = "none") + * theme_bw() ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_05_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ theme(legend.position = "none") + theme_bw() + * xlab("Anio desde PhD") ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_06_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + * ylab("(9-meses salario (USD)") ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_07_output-1.png)<!-- --> ] --- count: false Visualizar dos variables numéricas .panel1-geompoint-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)")+ * theme(axis.text=element_text(size=14), * axis.title =element_text(size=14, * face="bold")) ``` ] .panel2-geompoint-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_auto_08_output-1.png)<!-- --> ] <style> .panel1-geompoint-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-geompoint-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-geompoint-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r *salarios ``` ] .panel2-geompoint_lm-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% * ggplot(aes(x = anio.desde.phd, * y = salario)) ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_02_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + * geom_point() ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_03_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ * geom_smooth(method = "lm", * color="black") ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_04_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ geom_smooth(method = "lm", color="black") + * theme(legend.position = "none") ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_05_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ geom_smooth(method = "lm", color="black") + theme(legend.position = "none") + * theme_bw() ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_06_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ geom_smooth(method = "lm", color="black") + theme(legend.position = "none") + theme_bw() + * xlab("Anio desde PhD") ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_07_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ geom_smooth(method = "lm", color="black") + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + * ylab("(9-meses salario (USD)") ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_08_output-1.png)<!-- --> ] --- count: false regresión lineal .panel1-geompoint_lm-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ geom_smooth(method = "lm", color="black") + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)")+ * theme(axis.text=element_text(size=14), * axis.title =element_text(size=14, * face="bold")) ``` ] .panel2-geompoint_lm-auto[ ![](ggplot2_TallerR_easy_files/figure-html/geompoint_lm_auto_09_output-1.png)<!-- --> ] <style> .panel1-geompoint_lm-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-geompoint_lm-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-geompoint_lm-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- Hay varios métodos para hacer regresiones, fijate a la ayuda ```r ?geom_smooth ``` --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r *salarios ``` ] .panel2-facetwrap-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% * ggplot(aes(x = anio.desde.phd, * y = salario)) ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_02_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + * geom_point() ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_03_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ * facet_wrap(~sexo) ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_04_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ facet_wrap(~sexo) + * theme(legend.position = "none") ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_05_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ facet_wrap(~sexo) + theme(legend.position = "none") + * theme_bw() ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_06_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ facet_wrap(~sexo) + theme(legend.position = "none") + theme_bw() + * xlab("Anio desde PhD") ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_07_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ facet_wrap(~sexo) + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + * ylab("(9-meses salario (USD)") ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_08_output-1.png)<!-- --> ] --- count: false Un gráfico por diferentes grupos o categorías .panel1-facetwrap-auto[ ```r salarios %>% ggplot(aes(x = anio.desde.phd, y = salario)) + geom_point()+ facet_wrap(~sexo) + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)")+ * theme(axis.text=element_text(size=14), * axis.title =element_text(size=14, * face="bold")) ``` ] .panel2-facetwrap-auto[ ![](ggplot2_TallerR_easy_files/figure-html/facetwrap_auto_09_output-1.png)<!-- --> ] <style> .panel1-facetwrap-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-facetwrap-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-facetwrap-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: inverse, center, middle # Colores y simbolos --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r *salarios ``` ] .panel2-color-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% * ggplot(aes(x= anio.desde.phd, * y= salario, * color=rango)) ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_02_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + * geom_point() ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_03_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + geom_point()+ * theme(legend.position = "none") ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_04_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + geom_point()+ theme(legend.position = "none") + * theme_bw() ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_05_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + geom_point()+ theme(legend.position = "none") + theme_bw() + * xlab("Anio desde PhD") ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_06_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + geom_point()+ theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + * ylab("(9-meses salario (USD)") ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_07_output-1.png)<!-- --> ] --- count: false Usar colores para anadir una dimension mas .panel1-color-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, color=rango)) + geom_point()+ theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)")+ * theme(axis.text=element_text(size=14), * axis.title =element_text(size=14, * face="bold"), * legend.text=element_text(size=14), * legend.position = "bottom") ``` ] .panel2-color-auto[ ![](ggplot2_TallerR_easy_files/figure-html/color_auto_08_output-1.png)<!-- --> ] <style> .panel1-color-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-color-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-color-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> 'aes(x =... , y =... , color =...)' -> gráfico de tres dismensiones --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r *salarios ``` ] .panel2-pch-auto[ ``` rango disciplina anio.desde.phd anio.servicio sexo 1 Professor(a) B 19 18 Male 2 Professor(a) B 20 16 Male 3 Profesor(a) asistente B 4 3 Male 4 Professor(a) B 45 39 Male 5 Professor(a) B 40 41 Male 6 Profesor(a) asociada B 6 6 Male 7 Professor(a) B 30 23 Male 8 Professor(a) B 45 45 Male 9 Professor(a) B 21 20 Male 10 Professor(a) B 18 18 Female 11 Profesor(a) asociada B 12 8 Male 12 Profesor(a) asistente B 7 2 Male 13 Profesor(a) asistente B 1 1 Male 14 Profesor(a) asistente B 2 0 Male 15 Professor(a) B 20 18 Male 16 Professor(a) B 12 3 Male 17 Professor(a) B 19 20 Male 18 Professor(a) A 38 34 Male 19 Professor(a) A 37 23 Male 20 Professor(a) A 39 36 Female 21 Professor(a) A 31 26 Male 22 Professor(a) A 36 31 Male 23 Professor(a) A 34 30 Male 24 Professor(a) A 24 19 Male 25 Profesor(a) asociada A 13 8 Female 26 Professor(a) A 21 8 Male 27 Professor(a) A 35 23 Male 28 Profesor(a) asistente B 5 3 Male 29 Profesor(a) asistente B 11 0 Male 30 Professor(a) B 12 8 Male 31 Professor(a) B 20 4 Male 32 Profesor(a) asistente B 7 2 Male 33 Professor(a) B 13 9 Male 34 Profesor(a) asistente B 4 2 Male 35 Profesor(a) asistente B 4 2 Female 36 Profesor(a) asistente B 5 0 Female 37 Professor(a) B 22 21 Male 38 Profesor(a) asistente B 7 4 Male 39 Professor(a) B 41 31 Male 40 Profesor(a) asociada B 9 9 Male 41 Professor(a) B 23 2 Male 42 Profesor(a) asociada B 23 23 Male 43 Professor(a) B 40 27 Male 44 Professor(a) B 38 38 Male 45 Professor(a) B 19 19 Male 46 Professor(a) B 25 15 Male 47 Professor(a) B 40 28 Male 48 Professor(a) B 23 19 Female 49 Professor(a) B 25 25 Female 50 Profesor(a) asistente B 1 1 Male 51 Professor(a) B 28 28 Male 52 Professor(a) B 12 11 Male 53 Profesor(a) asistente B 11 3 Female 54 Professor(a) B 16 9 Male 55 Profesor(a) asociada B 12 11 Male 56 Profesor(a) asociada B 14 5 Male 57 Professor(a) B 23 21 Male 58 Profesor(a) asociada B 9 8 Male 59 Profesor(a) asociada B 10 9 Male 60 Profesor(a) asistente B 8 3 Male 61 Profesor(a) asociada B 9 8 Male 62 Profesor(a) asistente B 3 2 Male 63 Professor(a) B 33 31 Male 64 Profesor(a) asociada B 11 11 Female 65 Profesor(a) asistente B 4 3 Male 66 Profesor(a) asociada B 9 8 Male 67 Professor(a) B 22 12 Male 68 Professor(a) B 35 31 Male 69 Professor(a) B 17 17 Female 70 Professor(a) B 28 36 Male 71 Professor(a) B 17 2 Male 72 Professor(a) B 45 45 Male 73 Professor(a) B 29 19 Male 74 Professor(a) B 35 34 Male 75 Professor(a) B 28 23 Male 76 Profesor(a) asistente B 8 3 Male 77 Professor(a) B 17 3 Male 78 Professor(a) B 26 19 Male 79 Profesor(a) asistente B 3 1 Male 80 Profesor(a) asistente B 6 2 Male 81 Professor(a) B 43 28 Male 82 Professor(a) B 17 16 Male 83 Professor(a) B 22 20 Male 84 Profesor(a) asistente B 6 2 Male 85 Professor(a) B 17 18 Female 86 Professor(a) B 15 14 Male 87 Professor(a) B 37 37 Male 88 Profesor(a) asistente B 2 2 Male 89 Professor(a) B 25 25 Male 90 Profesor(a) asociada B 9 7 Male 91 Profesor(a) asistente B 10 5 Female 92 Profesor(a) asociada B 10 7 Male 93 Profesor(a) asociada B 10 7 Male 94 Professor(a) B 38 38 Male 95 Professor(a) B 21 20 Male 96 Profesor(a) asistente B 4 0 Male 97 Profesor(a) asociada B 17 12 Male 98 Professor(a) B 13 7 Male 99 Professor(a) B 30 14 Male 100 Professor(a) B 41 26 Male 101 Professor(a) B 42 25 Male 102 Professor(a) B 28 23 Male 103 Professor(a) B 16 5 Male 104 Professor(a) B 20 14 Female 105 Profesor(a) asociada A 18 10 Male 106 Professor(a) A 31 28 Male 107 Profesor(a) asociada A 11 8 Male 108 Profesor(a) asociada A 10 8 Male 109 Profesor(a) asociada A 15 8 Male 110 Professor(a) A 40 31 Male 111 Professor(a) A 20 16 Male 112 Profesor(a) asociada A 19 16 Male 113 Profesor(a) asistente A 3 1 Male 114 Professor(a) A 37 37 Male 115 Professor(a) A 12 0 Female 116 Professor(a) A 21 9 Male 117 Professor(a) A 30 29 Male 118 Professor(a) A 39 36 Male 119 Profesor(a) asistente A 4 1 Male 120 Profesor(a) asistente A 5 3 Female 121 Professor(a) A 14 14 Male 122 Professor(a) A 32 32 Male 123 Professor(a) A 24 22 Male 124 Profesor(a) asociada A 25 22 Female 125 Professor(a) A 24 22 Male 126 Professor(a) A 54 49 Male 127 Professor(a) A 28 26 Male 128 Profesor(a) asistente A 2 0 Female 129 Professor(a) A 32 30 Male 130 Profesor(a) asistente A 4 2 Male 131 Profesor(a) asociada A 11 9 Male 132 Professor(a) A 56 57 Male 133 Profesor(a) asociada A 10 8 Female 134 Profesor(a) asistente A 3 1 Female 135 Professor(a) A 35 25 Male 136 Professor(a) A 20 18 Male 137 Professor(a) A 16 14 Male 138 Professor(a) A 17 14 Male 139 Profesor(a) asociada A 10 7 Male 140 Professor(a) A 21 18 Male 141 Profesor(a) asociada A 14 8 Male 142 Profesor(a) asociada A 15 10 Male 143 Professor(a) A 19 11 Male 144 Profesor(a) asistente B 3 3 Male 145 Professor(a) B 27 27 Male 146 Professor(a) B 28 28 Male 147 Profesor(a) asistente B 4 4 Male 148 Professor(a) B 27 27 Male 149 Professor(a) B 36 26 Female 150 Profesor(a) asistente B 4 3 Male 151 Professor(a) B 14 12 Male 152 Profesor(a) asistente B 4 4 Male 153 Professor(a) B 21 9 Male 154 Profesor(a) asociada B 12 10 Female 155 Profesor(a) asistente B 4 0 Male 156 Professor(a) B 21 21 Male 157 Profesor(a) asociada B 12 18 Male 158 Profesor(a) asistente B 1 0 Male 159 Profesor(a) asociada B 6 6 Male 160 Professor(a) B 15 16 Male 161 Profesor(a) asistente B 2 2 Male 162 Professor(a) B 26 19 Male 163 Profesor(a) asociada B 22 7 Male 164 Profesor(a) asistente B 3 3 Male 165 Profesor(a) asistente B 1 0 Male 166 Professor(a) B 21 8 Male 167 Professor(a) B 16 16 Male 168 Professor(a) B 18 19 Male 169 Profesor(a) asociada B 8 6 Male 170 Professor(a) B 25 18 Male 171 Profesor(a) asistente B 5 5 Male 172 Professor(a) B 19 19 Male 173 Professor(a) B 37 24 Male 174 Professor(a) B 20 20 Male 175 Profesor(a) asociada B 17 6 Male 176 Professor(a) B 28 25 Male 177 Profesor(a) asociada B 10 7 Male 178 Profesor(a) asociada B 13 9 Male 179 Professor(a) B 27 14 Male 180 Profesor(a) asistente B 3 3 Female 181 Professor(a) B 11 11 Male 182 Professor(a) B 18 5 Male 183 Profesor(a) asociada B 8 8 Male 184 Professor(a) B 26 22 Male 185 Professor(a) B 23 23 Male 186 Professor(a) B 33 30 Male 187 Profesor(a) asociada B 13 10 Female 188 Professor(a) B 18 10 Male 189 Profesor(a) asociada B 28 28 Male 190 Professor(a) B 25 19 Male 191 Professor(a) B 22 9 Male 192 Professor(a) B 43 22 Male 193 Professor(a) B 19 18 Male 194 Profesor(a) asociada B 19 19 Male 195 Profesor(a) asociada B 48 53 Male 196 Profesor(a) asociada B 9 7 Male 197 Profesor(a) asistente B 4 4 Male 198 Profesor(a) asistente B 4 4 Male 199 Professor(a) B 34 33 Male 200 Professor(a) B 38 22 Male 201 Profesor(a) asistente B 4 4 Male 202 Professor(a) B 40 40 Male 203 Professor(a) B 28 17 Male 204 Professor(a) B 17 17 Male 205 Professor(a) B 19 5 Male 206 Professor(a) B 21 2 Male 207 Professor(a) B 35 33 Male 208 Professor(a) B 18 18 Male 209 Profesor(a) asistente B 7 2 Male 210 Professor(a) B 20 20 Male 211 Profesor(a) asistente B 4 3 Male 212 Professor(a) B 39 39 Male 213 Professor(a) B 15 7 Male 214 Professor(a) B 26 19 Male 215 Profesor(a) asociada B 11 1 Male 216 Professor(a) B 16 11 Male 217 Professor(a) B 15 11 Male 218 Profesor(a) asociada B 29 22 Male 219 Profesor(a) asociada B 14 7 Female 220 Professor(a) B 13 11 Male 221 Professor(a) B 21 21 Male 222 Professor(a) B 23 10 Male 223 Profesor(a) asociada B 13 6 Male 224 Professor(a) B 34 20 Male 225 Professor(a) A 38 35 Male 226 Professor(a) A 20 20 Male 227 Profesor(a) asistente A 3 1 Male 228 Profesor(a) asociada A 9 7 Male 229 Professor(a) A 16 11 Male 230 Professor(a) A 39 38 Male 231 Professor(a) A 29 27 Female 232 Profesor(a) asociada A 26 24 Female 233 Professor(a) A 38 19 Male 234 Professor(a) A 36 19 Female 235 Profesor(a) asistente A 8 3 Male 236 Professor(a) A 28 17 Male 237 Professor(a) A 25 25 Male 238 Profesor(a) asistente A 7 6 Female 239 Professor(a) A 46 40 Male 240 Professor(a) A 19 6 Male 241 Profesor(a) asistente A 5 3 Male 242 Professor(a) A 31 30 Male 243 Professor(a) A 38 37 Male 244 Professor(a) A 23 23 Male 245 Professor(a) A 19 23 Male 246 Professor(a) A 17 11 Female 247 Professor(a) A 30 23 Male 248 Professor(a) A 21 18 Male 249 Professor(a) A 28 23 Male 250 Professor(a) A 29 7 Male 251 Professor(a) A 39 39 Male 252 Professor(a) A 20 8 Male 253 Professor(a) A 31 12 Male 254 Profesor(a) asistente A 4 2 Female 255 Professor(a) A 28 7 Female 256 Profesor(a) asociada A 12 8 Male 257 Professor(a) A 22 22 Male 258 Profesor(a) asociada A 30 23 Male 259 Profesor(a) asistente A 9 3 Male 260 Professor(a) A 32 30 Male 261 Profesor(a) asociada A 41 33 Male 262 Professor(a) A 45 45 Male 263 Professor(a) A 31 26 Male 264 Professor(a) A 31 31 Male 265 Professor(a) A 37 35 Male 266 Professor(a) A 36 30 Male 267 Professor(a) A 43 43 Male 268 Professor(a) A 14 10 Male 269 Professor(a) A 47 44 Male 270 Professor(a) A 13 7 Male 271 Professor(a) A 42 40 Male 272 Professor(a) A 42 18 Male 273 Profesor(a) asistente A 4 1 Male 274 Profesor(a) asistente A 8 4 Male 275 Profesor(a) asistente A 8 3 Female 276 Professor(a) A 12 6 Male 277 Professor(a) A 52 48 Male 278 Professor(a) A 31 27 Male 279 Professor(a) A 24 18 Male 280 Professor(a) A 46 46 Male 281 Professor(a) A 39 38 Male 282 Professor(a) A 37 27 Male 283 Professor(a) A 51 51 Male 284 Professor(a) A 45 43 Male 285 Profesor(a) asociada A 8 6 Male 286 Profesor(a) asociada A 49 49 Male 287 Professor(a) A 28 27 Male 288 Profesor(a) asistente A 2 0 Male 289 Professor(a) A 29 27 Male 290 Profesor(a) asistente A 8 5 Male 291 Professor(a) A 33 7 Male 292 Professor(a) A 32 28 Male 293 Professor(a) A 39 9 Male 294 Profesor(a) asociada A 11 1 Male 295 Professor(a) A 19 7 Male 296 Professor(a) A 40 36 Male 297 Professor(a) A 18 18 Male 298 Professor(a) A 17 11 Male 299 Professor(a) A 49 43 Male 300 Profesor(a) asociada A 45 39 Male 301 Professor(a) A 39 36 Male 302 Professor(a) A 27 16 Male 303 Professor(a) A 28 13 Male 304 Professor(a) A 14 4 Male 305 Professor(a) A 46 44 Male 306 Professor(a) A 33 31 Male 307 Profesor(a) asistente A 7 4 Male 308 Professor(a) A 31 28 Male 309 Profesor(a) asistente A 5 0 Male 310 Professor(a) A 22 15 Male 311 Professor(a) A 20 7 Male 312 Professor(a) A 14 9 Male 313 Professor(a) A 29 19 Male 314 Professor(a) A 35 35 Male 315 Professor(a) A 22 6 Male 316 Profesor(a) asistente B 6 3 Male 317 Profesor(a) asociada B 12 9 Female 318 Professor(a) B 46 45 Male 319 Professor(a) B 16 16 Male 320 Professor(a) B 16 15 Male 321 Professor(a) B 24 23 Male 322 Profesor(a) asociada B 9 9 Male 323 Profesor(a) asociada B 13 11 Male 324 Professor(a) B 24 15 Female 325 Professor(a) B 30 31 Male 326 Profesor(a) asistente B 8 4 Male 327 Professor(a) B 23 15 Male 328 Professor(a) B 37 37 Male 329 Profesor(a) asociada B 10 10 Male 330 Professor(a) B 23 23 Male 331 Professor(a) B 49 60 Male 332 Professor(a) B 20 9 Male 333 Professor(a) B 18 10 Female 334 Professor(a) B 33 19 Male 335 Profesor(a) asociada B 19 6 Female 336 Professor(a) B 36 38 Male 337 Professor(a) B 35 23 Male 338 Professor(a) B 13 12 Male 339 Professor(a) B 32 25 Male 340 Professor(a) B 37 15 Male 341 Professor(a) B 13 11 Male 342 Professor(a) B 17 17 Female 343 Professor(a) B 38 38 Male 344 Professor(a) B 31 31 Male 345 Professor(a) B 32 35 Male 346 Professor(a) B 15 10 Male 347 Professor(a) B 41 27 Male 348 Professor(a) B 39 33 Male 349 Profesor(a) asistente B 4 3 Male 350 Professor(a) B 27 28 Male 351 Professor(a) B 56 49 Male 352 Professor(a) B 38 38 Male 353 Professor(a) B 26 27 Male 354 Professor(a) B 22 20 Male 355 Profesor(a) asistente B 8 1 Male 356 Professor(a) B 25 21 Male 357 Professor(a) A 49 40 Male 358 Professor(a) A 39 35 Male 359 Professor(a) A 28 14 Female 360 Profesor(a) asistente A 11 4 Male 361 Professor(a) A 14 11 Male 362 Professor(a) A 23 15 Female 363 Professor(a) A 30 30 Male 364 Profesor(a) asociada A 20 17 Male 365 Professor(a) A 43 43 Male 366 Professor(a) A 43 40 Male 367 Professor(a) A 15 10 Male 368 Profesor(a) asociada A 10 1 Male 369 Professor(a) A 35 30 Male 370 Professor(a) A 33 31 Male 371 Profesor(a) asociada A 13 8 Male 372 Professor(a) A 23 20 Male 373 Professor(a) A 12 7 Male 374 Professor(a) A 30 26 Male 375 Professor(a) A 27 19 Male 376 Professor(a) A 28 26 Male 377 Profesor(a) asistente A 4 1 Male 378 Profesor(a) asistente A 6 3 Male 379 Professor(a) A 38 38 Male 380 Profesor(a) asociada A 11 8 Male 381 Profesor(a) asistente A 8 3 Male 382 Professor(a) A 27 23 Male 383 Profesor(a) asociada A 8 5 Male 384 Professor(a) A 44 44 Male 385 Professor(a) A 27 21 Male 386 Professor(a) A 15 9 Male 387 Professor(a) A 29 27 Male 388 Professor(a) A 29 15 Male 389 Professor(a) A 38 36 Male 390 Professor(a) A 33 18 Male 391 Professor(a) A 40 19 Male 392 Professor(a) A 30 19 Male 393 Professor(a) A 33 30 Male 394 Professor(a) A 31 19 Male 395 Professor(a) A 42 25 Male 396 Professor(a) A 25 15 Male 397 Profesor(a) asistente A 8 4 Male salario 1 139750 2 173200 3 79750 4 115000 5 141500 6 97000 7 175000 8 147765 9 119250 10 129000 11 119800 12 79800 13 77700 14 78000 15 104800 16 117150 17 101000 18 103450 19 124750 20 137000 21 89565 22 102580 23 93904 24 113068 25 74830 26 106294 27 134885 28 82379 29 77000 30 118223 31 132261 32 79916 33 117256 34 80225 35 80225 36 77000 37 155750 38 86373 39 125196 40 100938 41 146500 42 93418 43 101299 44 231545 45 94384 46 114778 47 98193 48 151768 49 140096 50 70768 51 126621 52 108875 53 74692 54 106639 55 103760 56 83900 57 117704 58 90215 59 100135 60 75044 61 90304 62 75243 63 109785 64 103613 65 68404 66 100522 67 101000 68 99418 69 111512 70 91412 71 126320 72 146856 73 100131 74 92391 75 113398 76 73266 77 150480 78 193000 79 86100 80 84240 81 150743 82 135585 83 144640 84 88825 85 122960 86 132825 87 152708 88 88400 89 172272 90 107008 91 97032 92 105128 93 105631 94 166024 95 123683 96 84000 97 95611 98 129676 99 102235 100 106689 101 133217 102 126933 103 153303 104 127512 105 83850 106 113543 107 82099 108 82600 109 81500 110 131205 111 112429 112 82100 113 72500 114 104279 115 105000 116 120806 117 148500 118 117515 119 72500 120 73500 121 115313 122 124309 123 97262 124 62884 125 96614 126 78162 127 155500 128 72500 129 113278 130 73000 131 83001 132 76840 133 77500 134 72500 135 168635 136 136000 137 108262 138 105668 139 73877 140 152664 141 100102 142 81500 143 106608 144 89942 145 112696 146 119015 147 92000 148 156938 149 144651 150 95079 151 128148 152 92000 153 111168 154 103994 155 92000 156 118971 157 113341 158 88000 159 95408 160 137167 161 89516 162 176500 163 98510 164 89942 165 88795 166 105890 167 167284 168 130664 169 101210 170 181257 171 91227 172 151575 173 93164 174 134185 175 105000 176 111751 177 95436 178 100944 179 147349 180 92000 181 142467 182 141136 183 100000 184 150000 185 101000 186 134000 187 103750 188 107500 189 106300 190 153750 191 180000 192 133700 193 122100 194 86250 195 90000 196 113600 197 92700 198 92000 199 189409 200 114500 201 92700 202 119700 203 160400 204 152500 205 165000 206 96545 207 162200 208 120000 209 91300 210 163200 211 91000 212 111350 213 128400 214 126200 215 118700 216 145350 217 146000 218 105350 219 109650 220 119500 221 170000 222 145200 223 107150 224 129600 225 87800 226 122400 227 63900 228 70000 229 88175 230 133900 231 91000 232 73300 233 148750 234 117555 235 69700 236 81700 237 114000 238 63100 239 77202 240 96200 241 69200 242 122875 243 102600 244 108200 245 84273 246 90450 247 91100 248 101100 249 128800 250 204000 251 109000 252 102000 253 132000 254 77500 255 116450 256 83000 257 140300 258 74000 259 73800 260 92550 261 88600 262 107550 263 121200 264 126000 265 99000 266 134800 267 143940 268 104350 269 89650 270 103700 271 143250 272 194800 273 73000 274 74000 275 78500 276 93000 277 107200 278 163200 279 107100 280 100600 281 136500 282 103600 283 57800 284 155865 285 88650 286 81800 287 115800 288 85000 289 150500 290 74000 291 174500 292 168500 293 183800 294 104800 295 107300 296 97150 297 126300 298 148800 299 72300 300 70700 301 88600 302 127100 303 170500 304 105260 305 144050 306 111350 307 74500 308 122500 309 74000 310 166800 311 92050 312 108100 313 94350 314 100351 315 146800 316 84716 317 71065 318 67559 319 134550 320 135027 321 104428 322 95642 323 126431 324 161101 325 162221 326 84500 327 124714 328 151650 329 99247 330 134778 331 192253 332 116518 333 105450 334 145098 335 104542 336 151445 337 98053 338 145000 339 128464 340 137317 341 106231 342 124312 343 114596 344 162150 345 150376 346 107986 347 142023 348 128250 349 80139 350 144309 351 186960 352 93519 353 142500 354 138000 355 83600 356 145028 357 88709 358 107309 359 109954 360 78785 361 121946 362 109646 363 138771 364 81285 365 205500 366 101036 367 115435 368 108413 369 131950 370 134690 371 78182 372 110515 373 109707 374 136660 375 103275 376 103649 377 74856 378 77081 379 150680 380 104121 381 75996 382 172505 383 86895 384 105000 385 125192 386 114330 387 139219 388 109305 389 119450 390 186023 391 166605 392 151292 393 103106 394 150564 395 101738 396 95329 397 81035 ``` ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% * ggplot(aes(x= anio.desde.phd, * y= salario, * pch=rango, * color=rango)) ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_02_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + * geom_point(size=2) ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_03_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + geom_point(size=2) + * theme(legend.position = "none") ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_04_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + geom_point(size=2) + theme(legend.position = "none") + * theme_bw() ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_05_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + geom_point(size=2) + theme(legend.position = "none") + theme_bw() + * xlab("Anio desde PhD") ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_06_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + geom_point(size=2) + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + * ylab("(9-meses salario (USD)") ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_07_output-1.png)<!-- --> ] --- count: false Usar colores o formas para anadir una dimension mas .panel1-pch-auto[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario, pch=rango, color=rango)) + geom_point(size=2) + theme(legend.position = "none") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)")+ * theme(axis.text=element_text(size=14), * axis.title =element_text(size=14, * face="bold"), * legend.text=element_text(size=14), * legend.position = "bottom") ``` ] .panel2-pch-auto[ ![](ggplot2_TallerR_easy_files/figure-html/pch_auto_08_output-1.png)<!-- --> ] <style> .panel1-pch-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-pch-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-pch-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> **pch** se utiliza para establecer formas de puntos --- ### las formas de puntos <center><img src="images/pch.png" style="width: 50%" /> </center> --- count: false Las formas de puntos .panel1-pch_try-rotate[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario)) + * geom_point(size=2,pch=3) + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)") ``` ] .panel2-pch_try-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/pch_try_rotate_01_output-1.png)<!-- --> ] --- count: false Las formas de puntos .panel1-pch_try-rotate[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario)) + * geom_point(size=2,pch=17) + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)") ``` ] .panel2-pch_try-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/pch_try_rotate_02_output-1.png)<!-- --> ] --- count: false Las formas de puntos .panel1-pch_try-rotate[ ```r salarios %>% ggplot(aes(x= anio.desde.phd, y= salario)) + * geom_point(size=2,pch=6,color="red") + theme_bw() + xlab("Anio desde PhD") + ylab("(9-meses salario (USD)") ``` ] .panel2-pch_try-rotate[ ![](ggplot2_TallerR_easy_files/figure-html/pch_try_rotate_03_output-1.png)<!-- --> ] <style> .panel1-pch_try-rotate { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-pch_try-rotate { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-pch_try-rotate { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- <!-- adjust font size in this css code chunk, currently 80 --> <style type="text/css"> .remark-code{line-height: 1.5; font-size: 80%} @media print { .has-continuation { display: block; } } code.r.hljs.remark-code{ position: relative; overflow-x: hidden; } code.r.hljs.remark-code:hover{ overflow-x:visible; width: 500px; # border-style: solid; } .remark-slide-content { font-size: 24px; } </style> --- # Sitios en español que tratan de ggplot2 👩💻 https://www.rstudio.com/wp-content/uploads/2015/04/ggplot2-spanish.pdf https://www.datanalytics.com/libro_r/introduccion-a-ggplot2.html