Skip to content

Commit

Permalink
differences for PR #883
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 7, 2024
1 parent ac7bcd1 commit 2deebf1
Show file tree
Hide file tree
Showing 26 changed files with 102 additions and 1,779 deletions.
22 changes: 11 additions & 11 deletions 00-before-we-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ and help others to pinpoint where the issue might be. Try to...
sessionInfo()
```

```{.output}
```output
#> R version 4.3.3 (2024-02-29)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.4 LTS
Expand All @@ -454,20 +454,20 @@ sessionInfo()
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] RSQLite_2.3.4 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1
#> [5] dplyr_1.1.4 purrr_1.0.2 readr_2.1.4 tidyr_1.3.0
#> [9] tibble_3.2.1 ggplot2_3.4.4 tidyverse_2.0.0 knitr_1.45
#> [1] RSQLite_2.3.6 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1
#> [5] dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1
#> [9] tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0 knitr_1.46
#>
#> loaded via a namespace (and not attached):
#> [1] bit_4.0.5 gtable_0.3.4 compiler_4.3.3 renv_1.0.5
#> [5] highr_0.10 tidyselect_1.2.0 blob_1.2.4 scales_1.3.0
#> [1] bit_4.0.5 gtable_0.3.5 compiler_4.3.3 renv_1.0.7
#> [5] highr_0.10 tidyselect_1.2.1 blob_1.2.4 scales_1.3.0
#> [9] fastmap_1.1.1 yaml_2.3.8 R6_2.5.1 generics_0.1.3
#> [13] munsell_0.5.0 DBI_1.2.0 pillar_1.9.0 tzdb_0.4.0
#> [17] rlang_1.1.2 utf8_1.2.4 cachem_1.0.8 stringi_1.8.3
#> [21] xfun_0.41 bit64_4.0.5 memoise_2.0.1 timechange_0.2.0
#> [25] cli_3.6.2 withr_2.5.2 magrittr_2.0.3 grid_4.3.3
#> [13] munsell_0.5.1 DBI_1.2.2 pillar_1.9.0 tzdb_0.4.0
#> [17] rlang_1.1.3 utf8_1.2.4 cachem_1.0.8 stringi_1.8.4
#> [21] xfun_0.43 bit64_4.0.5 memoise_2.0.1 timechange_0.3.0
#> [25] cli_3.6.2 withr_3.0.0 magrittr_2.0.3 grid_4.3.3
#> [29] hms_1.1.3 lifecycle_1.0.4 vctrs_0.6.5 evaluate_0.23
#> [33] glue_1.6.2 fansi_1.0.6 colorspace_2.1-0 tools_4.3.3
#> [33] glue_1.7.0 fansi_1.0.6 colorspace_2.1-0 tools_4.3.3
#> [37] pkgconfig_2.0.3
```

Expand Down
34 changes: 17 additions & 17 deletions 01-intro-to-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Let's try a function that can take multiple arguments: `round()`.
round(3.14159)
```

```{.output}
```output
#> [1] 3
```

Expand All @@ -238,7 +238,7 @@ help for this function using `?round`.
args(round)
```

```{.output}
```output
#> function (x, digits = 0)
#> NULL
```
Expand All @@ -256,7 +256,7 @@ type `digits = 2` or however many we want.
round(3.14159, digits = 2)
```

```{.output}
```output
#> [1] 3.14
```

Expand All @@ -268,7 +268,7 @@ don't have to name them:
round(3.14159, 2)
```

```{.output}
```output
#> [1] 3.14
```

Expand All @@ -279,7 +279,7 @@ And if you do name the arguments, you can switch their order:
round(digits = 2, x = 3.14159)
```

```{.output}
```output
#> [1] 3.14
```

Expand Down Expand Up @@ -459,15 +459,15 @@ animals <- c("mouse", "rat", "dog", "cat")
animals[2]
```

```{.output}
```output
#> [1] "rat"
```

```r
animals[c(3, 2)]
```

```{.output}
```output
#> [1] "dog" "rat"
```

Expand All @@ -480,7 +480,7 @@ more_animals <- animals[c(1, 2, 3, 2, 1, 4)]
more_animals
```

```{.output}
```output
#> [1] "mouse" "rat" "dog" "rat" "mouse" "cat"
```

Expand All @@ -500,7 +500,7 @@ weight_g <- c(21, 34, 39, 54, 55)
weight_g[c(TRUE, FALSE, FALSE, TRUE, TRUE)]
```

```{.output}
```output
#> [1] 21 54 55
```

Expand All @@ -513,7 +513,7 @@ values above 50:
weight_g > 50 # will return logicals with TRUE for the indices that meet the condition
```

```{.output}
```output
#> [1] FALSE FALSE FALSE TRUE TRUE
```

Expand All @@ -522,7 +522,7 @@ weight_g > 50 # will return logicals with TRUE for the indices that meet the
weight_g[weight_g > 50]
```

```{.output}
```output
#> [1] 54 55
```

Expand All @@ -534,23 +534,23 @@ You can combine multiple tests using `&` (both conditions are true, AND) or `|`
weight_g[weight_g > 30 & weight_g < 50]
```

```{.output}
```output
#> [1] 34 39
```

```r
weight_g[weight_g <= 30 | weight_g == 55]
```

```{.output}
```output
#> [1] 21 55
```

```r
weight_g[weight_g >= 30 & weight_g == 21]
```

```{.output}
```output
#> numeric(0)
```

Expand All @@ -573,7 +573,7 @@ animals <- c("mouse", "rat", "dog", "cat", "cat")
animals[animals == "cat" | animals == "rat"]
```

```{.output}
```output
#> [1] "rat" "cat" "cat"
```

Expand All @@ -583,7 +583,7 @@ animals[animals == "cat" | animals == "rat"]
animals %in% c("rat", "cat", "dog", "duck", "goat", "bird", "fish")
```

```{.output}
```output
#> [1] FALSE TRUE TRUE TRUE TRUE
```

Expand All @@ -593,7 +593,7 @@ animals %in% c("rat", "cat", "dog", "duck", "goat", "bird", "fish")
animals[animals %in% c("rat", "cat", "dog", "duck", "goat", "bird", "fish")]
```

```{.output}
```output
#> [1] "rat" "dog" "cat" "cat"
```

Expand Down
28 changes: 14 additions & 14 deletions 02-starting-with-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ about data frames later):
surveys <- read_csv("data_raw/portal_data_joined.csv")
```

```{.output}
```output
#> Rows: 34786 Columns: 13
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
Expand Down Expand Up @@ -175,7 +175,7 @@ We can also extract the first few lines of this data using the function
head(surveys)
```

```{.output}
```output
#> # A tibble: 6 × 13
#> record_id month day year plot_id species_id sex hindfoot_length weight
#> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <dbl> <dbl>
Expand Down Expand Up @@ -290,7 +290,7 @@ questions?
str(surveys)
```

```{.output}
```output
#> spc_tbl_ [34,786 × 13] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
#> $ record_id : num [1:34786] 1 72 224 266 349 363 435 506 588 661 ...
#> $ month : num [1:34786] 7 8 9 10 11 11 12 1 2 3 ...
Expand Down Expand Up @@ -532,7 +532,7 @@ the `sex` vector would be:
sex # current order
```

```{.output}
```output
#> [1] male female female male
#> Levels: female male
```
Expand All @@ -542,7 +542,7 @@ sex <- factor(sex, levels = c("male", "female"))
sex # after re-ordering
```

```{.output}
```output
#> [1] male female female male
#> Levels: male female
```
Expand Down Expand Up @@ -650,7 +650,7 @@ sex <- surveys$sex
levels(sex)
```

```{.output}
```output
#> [1] "F" "M"
```

Expand All @@ -659,15 +659,15 @@ sex <- addNA(sex)
levels(sex)
```

```{.output}
```output
#> [1] "F" "M" NA
```

```r
head(sex)
```

```{.output}
```output
#> [1] M M <NA> <NA> <NA> <NA>
#> Levels: F M <NA>
```
Expand All @@ -677,15 +677,15 @@ levels(sex)[3] <- "undetermined"
levels(sex)
```

```{.output}
```output
#> [1] "F" "M" "undetermined"
```

```r
head(sex)
```

```{.output}
```output
#> [1] M M undetermined undetermined undetermined
#> [6] undetermined
#> Levels: F M undetermined
Expand Down Expand Up @@ -844,7 +844,7 @@ This character vector can be used as the argument for `ymd()`:
ymd(paste(surveys$year, surveys$month, surveys$day, sep = "-"))
```

```{.warning}
```warning
#> Warning: 129 failed to parse.
```

Expand All @@ -859,7 +859,7 @@ vector to the `surveys` data frame as a new column called `date`:
surveys$date <- ymd(paste(surveys$year, surveys$month, surveys$day, sep = "-"))
```

```{.warning}
```warning
#> Warning: 129 failed to parse.
```

Expand All @@ -875,7 +875,7 @@ column is to use `summary()`:
summary(surveys$date)
```

```{.output}
```output
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> "1977-07-16" "1984-03-12" "1990-07-22" "1990-12-15" "1997-07-29" "2002-12-31"
#> NA's
Expand All @@ -898,7 +898,7 @@ missing_dates <- surveys[is.na(surveys$date), c("year", "month", "day")]
head(missing_dates)
```

```{.output}
```output
#> # A tibble: 6 × 3
#> year month day
#> <dbl> <dbl> <dbl>
Expand Down
Loading

0 comments on commit 2deebf1

Please sign in to comment.