Skip to content

Commit 07f5cd1

Browse files
committed
differences for PR #174
1 parent 3ab55f2 commit 07f5cd1

15 files changed

+94
-56
lines changed

01-rstudio-intro.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
575575
}
576576
else all.names
577577
}
578-
<bytecode: 0x562415a57fb0>
578+
<bytecode: 0x55dadd579030>
579579
<environment: namespace:base>
580580
```
581581

@@ -606,7 +606,8 @@ rm(list <- ls())
606606
```
607607

608608
``` error
609-
Error in rm(list <- ls()): ... must contain names or character strings
609+
Error in `rm()`:
610+
! ... must contain names or character strings
610611
```
611612

612613
::::::::::::::::::::::::::::::::::::::::: callout

02-project-intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ ls -lh data/gapminder-FiveYearData.csv
210210
```
211211

212212
``` output
213-
-rw-r--r-- 1 runner runner 80K Apr 7 00:55 data/gapminder-FiveYearData.csv
213+
-rw-r--r-- 1 runner runner 80K Apr 7 01:01 data/gapminder-FiveYearData.csv
214214
```
215215

216216
El tamaño del archivo es 80K.

03-seeking-help.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ attached base packages:
151151
[1] stats graphics grDevices utils datasets methods base
152152
153153
loaded via a namespace (and not attached):
154-
[1] compiler_4.5.3 tools_4.5.3 yaml_2.3.10 knitr_1.50 xfun_0.53
155-
[6] renv_1.2.0 evaluate_1.0.5
154+
[1] compiler_4.5.3 cli_3.6.5 tools_4.5.3 yaml_2.3.12 knitr_1.51
155+
[6] xfun_0.57 rlang_1.2.0 renv_1.2.0 evaluate_1.0.5
156156
```
157157

158158
Imprimirá tu versión actual de R, así como cualquier paquete que hayas

05-data-structures-part2.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ cbind(gatos, edad)
8484
```
8585

8686
``` error
87-
Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 3, 4
87+
Error in `data.frame()`:
88+
! arguments imply differing number of rows: 3, 4
8889
```
8990

9091
``` r
@@ -93,7 +94,8 @@ cbind(gatos, edad)
9394
```
9495

9596
``` error
96-
Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 3, 2
97+
Error in `data.frame()`:
98+
! arguments imply differing number of rows: 3, 2
9799
```
98100

99101
¿Por qué no funcionó? Claro, R quiere ver un elemento en nuestra nueva columna para cada fila de la tabla:
@@ -657,12 +659,12 @@ gapminder[sample(nrow(gapminder), 5), ]
657659
```
658660

659661
``` output
660-
country year pop continent lifeExp gdpPercap
661-
270 Chad 1977 4388260 Africa 47.383 1133.9850
662-
1288 Rwanda 1967 3451079 Africa 44.100 510.9637
663-
221 Cambodia 1972 7450606 Asia 40.317 421.6240
664-
216 Burundi 2007 8390505 Africa 49.580 430.0707
665-
1376 Slovak Republic 1987 5199318 Europe 71.080 12037.2676
662+
country year pop continent lifeExp gdpPercap
663+
1092 Netherlands 2007 16570613 Europe 79.762 36797.9333
664+
925 Malawi 1952 2917802 Africa 36.256 369.1651
665+
769 Italy 1952 47666000 Europe 65.940 4931.4042
666+
57 Argentina 1992 33958947 Americas 71.868 9308.4187
667+
252 Canada 2007 33390141 Americas 80.653 36319.2350
666668
```
667669

668670
:::::::::::::::::::::::::

06-data-subsetting.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ Esto nos devuelve un error algo críptico:
218218

219219

220220
``` error
221-
Error in x[-1:3]: only 0's may be mixed with negative subscripts
221+
Error in `x[-1:3]`:
222+
! only 0's may be mixed with negative subscripts
222223
```
223224

224225
Pero recuerda el orden de las operaciones. `:` es en realidad una función. Toma
@@ -536,7 +537,8 @@ x[-"a"]
536537
```
537538

538539
``` error
539-
Error in -"a": invalid argument to unary operator
540+
Error in `-"a"`:
541+
! invalid argument to unary operator
540542
```
541543

542544
Sin embargo, podemos usar el operador `!=` (no igual) para construir un vector
@@ -833,7 +835,8 @@ m[, c(3,6)]
833835
```
834836

835837
``` error
836-
Error in m[, c(3, 6)]: subscript out of bounds
838+
Error in `m[, c(3, 6)]`:
839+
! subscript out of bounds
837840
```
838841

839842
::::::::::::::::::::::::::::::::::::::::: callout
@@ -994,7 +997,8 @@ xlist[[1:2]]
994997
```
995998

996999
``` error
997-
Error in xlist[[1:2]]: subscript out of bounds
1000+
Error in `xlist[[1:2]]`:
1001+
! subscript out of bounds
9981002
```
9991003

10001004
Tampoco puedes usarlo para saltar elementos:
@@ -1005,7 +1009,8 @@ xlist[[-1]]
10051009
```
10061010

10071011
``` error
1008-
Error in xlist[[-1]]: invalid negative subscript in get1index <real>
1012+
Error in `xlist[[-1]]`:
1013+
! invalid negative subscript in get1index <real>
10091014
```
10101015

10111016
Pero tú puedes usar los nombres para hacer subconjuntos y extraer elementos:

07-control-flow.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ if(any(gapminder$year == 2002)){
185185

186186

187187
``` error
188-
Error: object 'gapminder' not found
188+
Error:
189+
! object 'gapminder' not found
189190
```
190191

191192
Si tu condición se evalúa como un vector con más de un elemento lógico,
@@ -551,7 +552,8 @@ for( iCountry in unique(gapminder$country) ){
551552
```
552553

553554
``` error
554-
Error: object 'gapminder' not found
555+
Error:
556+
! object 'gapminder' not found
555557
```
556558

557559
:::::::::::::::::::::::::

08-plot-ggplot2.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ggplot(data = gapminder, mapping = aes(x = gdpPercap, y = lifeExp)) +
9393
geom_point()
9494
```
9595

96-
<img src="fig/08-plot-ggplot2-rendered-build-ggplot-3-1.png" style="display: block; margin: auto;" />
96+
<img src="fig/08-plot-ggplot2-rendered-build-ggplot-3-1.png" alt="" style="display: block; margin: auto;" />
9797

9898
::::::::::::::::::::::::::::::::::::::: challenge
9999

@@ -124,7 +124,7 @@ Esta es una posible solución:
124124
ggplot(data = gapminder, aes(x = year, y = lifeExp)) + geom_point()
125125
```
126126

127-
<img src="fig/08-plot-ggplot2-rendered-ch1-sol-1.png" style="display: block; margin: auto;" />
127+
<img src="fig/08-plot-ggplot2-rendered-ch1-sol-1.png" alt="" style="display: block; margin: auto;" />
128128

129129
:::::::::::::::::::::::::
130130

@@ -154,7 +154,7 @@ ggplot(data = gapminder, aes(x = year, y = lifeExp, color=continent)) +
154154
geom_point()
155155
```
156156

157-
<img src="fig/08-plot-ggplot2-rendered-ch2-sol-1.png" style="display: block; margin: auto;" />
157+
<img src="fig/08-plot-ggplot2-rendered-ch2-sol-1.png" alt="" style="display: block; margin: auto;" />
158158

159159
:::::::::::::::::::::::::
160160

@@ -171,7 +171,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country, color=continent)) +
171171
geom_line()
172172
```
173173

174-
<img src="fig/08-plot-ggplot2-rendered-lifeExp-line-1.png" style="display: block; margin: auto;" />
174+
<img src="fig/08-plot-ggplot2-rendered-lifeExp-line-1.png" alt="" style="display: block; margin: auto;" />
175175

176176
En vez de agregar una capa `geom_point`, hemos agregado una capa `geom_line`.
177177
Además, hemos agregado el argumento **aesthetic** **by**, el cual le dice a `ggplot` que
@@ -186,7 +186,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country, color=continent)) +
186186
geom_line() + geom_point()
187187
```
188188

189-
<img src="fig/08-plot-ggplot2-rendered-lifeExp-line-point-1.png" style="display: block; margin: auto;" />
189+
<img src="fig/08-plot-ggplot2-rendered-lifeExp-line-point-1.png" alt="" style="display: block; margin: auto;" />
190190

191191
Es importante notar que cada capa se dibuja encima de la capa anterior. En este ejemplo,
192192
los puntos se han dibujado *sobre* las líneas. A continuación observamos una demostración:
@@ -197,7 +197,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country)) +
197197
geom_line(aes(color=continent)) + geom_point()
198198
```
199199

200-
<img src="fig/08-plot-ggplot2-rendered-lifeExp-layer-example-1-1.png" style="display: block; margin: auto;" />
200+
<img src="fig/08-plot-ggplot2-rendered-lifeExp-layer-example-1-1.png" alt="" style="display: block; margin: auto;" />
201201

202202
En este ejemplo, el mapeo **aesthetic** de **color** se ha movido de las opciones globales de la gráfica en
203203
`ggplot` a la capa `geom_line` y, por lo tanto, ya no es válido para los puntos.
@@ -236,7 +236,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country)) +
236236
geom_point() + geom_line(aes(color=continent))
237237
```
238238

239-
<img src="fig/08-plot-ggplot2-rendered-ch3-sol-1.png" style="display: block; margin: auto;" />
239+
<img src="fig/08-plot-ggplot2-rendered-ch3-sol-1.png" alt="" style="display: block; margin: auto;" />
240240

241241
¡Las líneas ahora están dibujadas sobre los puntos!
242242

@@ -255,7 +255,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp, color=continent)) +
255255
geom_point()
256256
```
257257

258-
<img src="fig/08-plot-ggplot2-rendered-lifeExp-vs-gdpPercap-scatter3-1.png" style="display: block; margin: auto;" />
258+
<img src="fig/08-plot-ggplot2-rendered-lifeExp-vs-gdpPercap-scatter3-1.png" alt="" style="display: block; margin: auto;" />
259259

260260
En este momento es difícil ver las relaciones entre los puntos debido a algunos
261261
valores altamente atípicos de la variable GDP per capita. Podemos cambiar la escala de unidades del eje X
@@ -270,7 +270,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
270270
geom_point(alpha = 0.5) + scale_x_log10()
271271
```
272272

273-
<img src="fig/08-plot-ggplot2-rendered-axis-scale-1.png" style="display: block; margin: auto;" />
273+
<img src="fig/08-plot-ggplot2-rendered-axis-scale-1.png" alt="" style="display: block; margin: auto;" />
274274

275275
La función `log10` aplica una transformación sobre los valores de la columna "gdpPercap"
276276
antes de presentarlos en el gráfico, de manera que cada múltiplo de 10 ahora
@@ -304,7 +304,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
304304
`geom_smooth()` using formula = 'y ~ x'
305305
```
306306

307-
<img src="fig/08-plot-ggplot2-rendered-lm-fit-1.png" style="display: block; margin: auto;" />
307+
<img src="fig/08-plot-ggplot2-rendered-lm-fit-1.png" alt="" style="display: block; margin: auto;" />
308308

309309
Podemos hacer la línea más gruesa *configurando* el argumento **aesthetic** **tamaño** en la capa `geom_smooth`:
310310

@@ -326,7 +326,7 @@ generated.
326326
`geom_smooth()` using formula = 'y ~ x'
327327
```
328328

329-
<img src="fig/08-plot-ggplot2-rendered-lm-fit2-1.png" style="display: block; margin: auto;" />
329+
<img src="fig/08-plot-ggplot2-rendered-lm-fit2-1.png" alt="" style="display: block; margin: auto;" />
330330

331331
Existen dos formas en las que un *aesthetic* puede ser especificado. Aquí *configuramos* el
332332
**aesthetic** **tamaño** pasándolo como un argumento a `geom_smooth`. Previamente en la lección
@@ -359,7 +359,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
359359
`geom_smooth()` using formula = 'y ~ x'
360360
```
361361

362-
<img src="fig/08-plot-ggplot2-rendered-ch4a-sol-1.png" style="display: block; margin: auto;" />
362+
<img src="fig/08-plot-ggplot2-rendered-ch4a-sol-1.png" alt="" style="display: block; margin: auto;" />
363363

364364
:::::::::::::::::::::::::
365365

@@ -396,7 +396,7 @@ geom_smooth(method="lm", size=1.5)
396396
`geom_smooth()` using formula = 'y ~ x'
397397
```
398398

399-
<img src="fig/08-plot-ggplot2-rendered-ch4b-sol-1.png" style="display: block; margin: auto;" />
399+
<img src="fig/08-plot-ggplot2-rendered-ch4b-sol-1.png" alt="" style="display: block; margin: auto;" />
400400

401401
:::::::::::::::::::::::::
402402

@@ -429,7 +429,7 @@ ggplot(data = az.countries, aes(x = year, y = lifeExp, color=continent)) +
429429
geom_line() + facet_wrap( ~ country)
430430
```
431431

432-
<img src="fig/08-plot-ggplot2-rendered-facet-1.png" style="display: block; margin: auto;" />
432+
<img src="fig/08-plot-ggplot2-rendered-facet-1.png" alt="" style="display: block; margin: auto;" />
433433

434434
La capa `facet_wrap` toma una "fórmula" como argumento, lo cual se indica por el símbolo `~`.
435435
Esto le dice a R que debe dibujar un panel para cada valor único de la columna "country"
@@ -461,7 +461,7 @@ ggplot(data = az.countries, aes(x = year, y = lifeExp, color=continent)) +
461461
theme(axis.text.x=element_blank(), axis.ticks.x=element_blank())
462462
```
463463

464-
<img src="fig/08-plot-ggplot2-rendered-theme-1.png" style="display: block; margin: auto;" />
464+
<img src="fig/08-plot-ggplot2-rendered-theme-1.png" alt="" style="display: block; margin: auto;" />
465465

466466
## Exportando una gráfica
467467

@@ -531,7 +531,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, fill=continent)) +
531531
geom_density(alpha=0.6) + facet_wrap( ~ year) + scale_x_log10()
532532
```
533533

534-
<img src="fig/08-plot-ggplot2-rendered-ch5-sol-1.png" style="display: block; margin: auto;" />
534+
<img src="fig/08-plot-ggplot2-rendered-ch5-sol-1.png" alt="" style="display: block; margin: auto;" />
535535

536536
:::::::::::::::::::::::::
537537

09-vectorization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ ggplot(gapminder, aes(x = year, y = pop_millions)) +
124124
geom_point()
125125
```
126126

127-
<img src="fig/09-vectorization-rendered-ch2-sol-1.png" style="display: block; margin: auto;" />
127+
<img src="fig/09-vectorization-rendered-ch2-sol-1.png" alt="" style="display: block; margin: auto;" />
128128

129129
``` r
130130
countryset <- c("China","India","Indonesia")
@@ -133,7 +133,7 @@ ggplot(gapminder[gapminder$country %in% countryset,],
133133
geom_point()
134134
```
135135

136-
<img src="fig/09-vectorization-rendered-ch2-sol-2.png" style="display: block; margin: auto;" />
136+
<img src="fig/09-vectorization-rendered-ch2-sol-2.png" alt="" style="display: block; margin: auto;" />
137137

138138
:::::::::::::::::::::::::
139139

10-functions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ fahr_to_kelvin(temp = as.factor(32))
295295
```
296296

297297
``` error
298-
Error in fahr_to_kelvin(temp = as.factor(32)): is.numeric(temp) is not TRUE
298+
Error in `fahr_to_kelvin()`:
299+
! is.numeric(temp) is not TRUE
299300
```
300301

301302
::::::::::::::::::::::::::::::::::::::: challenge

0 commit comments

Comments
 (0)