diff --git a/slides/01-r-pkg-intro.qmd b/slides/01-r-pkg-intro.qmd index 2bda4ca..ea5af75 100644 --- a/slides/01-r-pkg-intro.qmd +++ b/slides/01-r-pkg-intro.qmd @@ -91,7 +91,7 @@ mtcars |> ## Packaging our code ::: incremental -- Allows us to more easily reuse the in many different projects, in a less error-prone way +- Allows us to more easily reuse it in many different projects, in a less error-prone way - Lets others benefit from the code we have written - Increases our code quality because when packaging we: - must modularize our code into functions and write function reference documentation diff --git a/slides/02-build-first-pkg.qmd b/slides/02-build-first-pkg.qmd index 9ff90de..c598a17 100644 --- a/slides/02-build-first-pkg.qmd +++ b/slides/02-build-first-pkg.qmd @@ -177,9 +177,9 @@ count_classes <- function(data_frame, class_col) { ### Syntax `package::function()` -- `count_classes()` includes three {dplyr} functions: - - `group_by()`, `summarize()`, and `rename()` -- Alternatively, we can use the syntax `dplyr::group_by()`, `dplyr::summarize()`, and `dplyr::rename()` +- `count_classes()` includes four {dplyr} functions: + - `group_by()`, `summarize()`, `n()`, and `rename()` +- Alternatively, we can use the syntax `dplyr::group_by()`, `dplyr::summarize()`, `dplyr::n()`, and `dplyr::rename()` - This syntax is recommended since it makes explicit which package each dependency is coming from within our package functions ### Re-writing our function @@ -195,7 +195,7 @@ count_classes <- function(data_frame, class_col) { data_frame |> dplyr::group_by({{ class_col }}) |> - dplyr::summarize(count = n()) |> + dplyr::summarize(count = dplyr::n()) |> dplyr::rename("class" = {{ class_col }}) } ```