Skip to content

Commit 5d2a9b5

Browse files
Fix typos and some other small tweaks (#531)
* Fix typos and some other small tweaks * Knit after Jenny's changes Co-authored-by: Mine Çetinkaya-Rundel <[email protected]>
1 parent 95ecabe commit 5d2a9b5

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

content/blog/teach-tidyverse-2021/index.Rmd

+10-9
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ library(tidyverse)
5757

5858
Before we dive into specific package functionality updates, I'd like to highlight two new teaching and learning resources:
5959

60-
- **Cheatsheets:** Some of the most popular learning resources for tidyverse are the cheatsheets and many of which have recently been updated. Huge thanks to our intern [Averi Perny](https://twitter.com/avperny) on the fantastic work on this project! You can read more about the updates [here](https://blog.rstudio.com/2021/08/23/cheat-sheet-updates/) and find the new cheatsheets [here](https://www.rstudio.com/resources/cheatsheets/).
60+
- **Cheatsheets:** Some of the most popular learning resources for the tidyverse are the cheatsheets, many of which have recently been updated. Huge thanks to our intern [Averi Perny](https://twitter.com/avperny) on the fantastic work on this project! You can read more about the updates [here](https://blog.rstudio.com/2021/08/23/cheat-sheet-updates/) and find the new cheatsheets [here](https://www.rstudio.com/resources/cheatsheets/).
6161
- **ggplot2 FAQ:** A new resource that might be useful for learners is the FAQ we've recently developed for ggplot2, which you can access [here](https://ggplot2.tidyverse.org/articles/). These were compiled based on popular questions on StackOverflow and RStudio Community. Each question is accompanied with a short answer as well as an expanded example.
6262

6363
## Lifecycle stages
6464

6565
The [**lifecycle**](https://lifecycle.r-lib.org/) package is used to manage the lifecycle of functions and features within the tidyverse, with clear messaging about what is still experimental and what the tidyverse team is moving away from in the future.
66-
But instead of focusing on the package that implements this concept, when teaching I recommend focusing on the stages of the lifecycle instead.
66+
But instead of focusing on the package that implements this concept, when teaching, I recommend focusing on the stages of the lifecycle instead.
6767
These are *experimental*, *stable*, *deprecated*, and *superseded*.
68-
The lifecycle stages are a useful guide for teaching because they help you see what the tidyverse is moving forward and what it's moving away from.
68+
The lifecycle stages are a useful guide for teaching because they help you see what the tidyverse is moving toward and what it's moving away from.
6969
Being aware of the lifecycle stages (and their associated badges) can be helpful as you review and revise your teaching materials or as you consider incorporating new tooling into your teaching.
7070

71-
The diagram below depicts the lifecycle of the various stages of functions and packages in the tidyverse.
71+
The diagram below depicts the lifecycle stages of functions and packages in the tidyverse.
7272

7373
![A diagram showing the transitions between the four main stages: experimental can become stable and stable can become deprecated or superseded.](lifecycle.png)
7474

@@ -77,7 +77,7 @@ Let's discuss each of these stages in detail, along with recommendations on how
7777
- <img src="lifecycle-stable.svg" alt="Stable" style="vertical-align:middle"/> Stable indicates that breaking changes will be avoided where possible, and they're only made if the long term benefit of such a change exceeds the short term pain of changing existing code.
7878
If breaking changes are needed, they will occur gradually.
7979
This is the default state for most functions in the tidyverse and hence the badge is generally not shown.
80-
Teaching tip: teach away any stable functions, they're here to stay for the long run!
80+
Teaching tip: feel free to teach any stable functions, they're here to stay for the long run!
8181

8282
- <img src="lifecycle-deprecated.svg" alt="Deprecated" style="vertical-align:middle"/> If a function is noted as deprecated, this means a better alternative is available and this function is scheduled for removal.
8383
Generally functions will first be soft deprecated and then deprecated.
@@ -118,17 +118,18 @@ If you'd like to learn more about the tidyverse lifecycle, I recommend the follo
118118
The [**reprex**](https://reprex.tidyverse.org/) package helps users create **repr**oducible **ex**amples for posting to GitHub issues, StackOverflow, in Slack messages or snippets, or even to paste into PowerPoint or Keynote slides by placing the code to be shared in your clipboard.
119119
I find reprex very useful when teaching because it helps my students provide me with broken code in a way that makes it as easy as possible for me (and for other students in the class) to help them.
120120

121-
There has been [many](https://reprex.tidyverse.org/news/index.html#reprex-1-0-0-2021-01-27) [exciting](https://reprex.tidyverse.org/news/index.html#reprex-2-0-0-2021-04-02) developments in reprex over the year.
121+
There have been [many](https://reprex.tidyverse.org/news/index.html#reprex-1-0-0-2021-01-27) [exciting](https://reprex.tidyverse.org/news/index.html#reprex-2-0-0-2021-04-02) developments in reprex over the year.
122122
The one that is perhaps most relevant to teaching are improvements that make it easier to use reprex when working in [RStudio Server](https://www.rstudio.com/products/rstudio/#rstudio-server) and [RStudio Cloud](https://rstudio.cloud/) as well as those that allow using local data when creating a reprex.
123123

124-
Many courses teache R using RStudio Server or RStudio Cloud since this approach circumvents the need for students to install software and allows the instructor to have full control over the R environment their students are learning in.
124+
Many courses teach R using RStudio Server or RStudio Cloud since this approach circumvents the need for students to install software and allows the instructor to have full control over the R environment their students are learning in.
125125
When working in these environments, the R code is running in a web browser and for security reasons it's not possible for reprex to place code on your system clipboard.
126126
When creating a reprex in these environments, you can now simply select the relevant code, and run `reprex()`.
127127
This will create a `.md` file containing the contents of the reprex, ready for you to copy via Cmd/Ctrl+C.
128128

129129
<img src="reprex-cloud.png" alt="On the left: RStudio Cloud window with an R script with two lines of code highlighted. On the right: Result after running reprex() in the Console, including a new markdown file with the name vivid-eider_reprex.md that includes the code and the resulting output, commented out, and selected, ready to be copy pasted elsewhere. The viewer pane on the bottom right shows the stylized result of the reprex." width="1000"/>
130130

131-
Another development that will help students, particularly those working on an assignment involving a local data file, create reprexes is the new `wd` argument to set working directory of the reprex.[^2]
131+
The new `wd` argument can help students create reprexes when they are working on an assignment involving a local data file.
132+
When `reprex(wd = ".")`, the reprex will be executed in the current working directory.[^2]
132133
Writing a reproducible example with a minimal dataset is better practice, but this can be quite difficult for new learners.
133134
Being able to easily use local data will make it easier for them to benefit from other aspects of reprex earlier on.
134135

@@ -417,7 +418,7 @@ cyl_summary %>% show_query()
417418
```
418419

419420
With recent updates, dtplyr can also translate some tidyr functions to data.table, e.g., `pivot_wider()`.
420-
In the following example the process is the same: start with `lazy_dt()`, write a data transformation step using tidyverse code, view the resut with `as_tibble()`, and view the query with `show_query()`.
421+
In the following example the process is the same: start with `lazy_dt()`, write a data transformation step using tidyverse code, view the result with `as_tibble()`, and view the query with `show_query()`.
421422

422423
```{r}
423424
fish_encounters_dt <- lazy_dt(fish_encounters)

content/blog/teach-tidyverse-2021/index.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ photo:
1717
# one of: "deep-dive", "learn", "package", "programming", or "other"
1818
categories: [learn]
1919
tags: [tidyverse, teaching]
20-
rmd_hash: e3970444e051b714
20+
rmd_hash: 11fdf5ca653acb05
2121

2222
---
2323

@@ -66,20 +66,20 @@ Let's get started!
6666

6767
Before we dive into specific package functionality updates, I'd like to highlight two new teaching and learning resources:
6868

69-
- **Cheatsheets:** Some of the most popular learning resources for tidyverse are the cheatsheets and many of which have recently been updated. Huge thanks to our intern [Averi Perny](https://twitter.com/avperny) on the fantastic work on this project! You can read more about the updates [here](https://blog.rstudio.com/2021/08/23/cheat-sheet-updates/) and find the new cheatsheets [here](https://www.rstudio.com/resources/cheatsheets/).
69+
- **Cheatsheets:** Some of the most popular learning resources for the tidyverse are the cheatsheets, many of which have recently been updated. Huge thanks to our intern [Averi Perny](https://twitter.com/avperny) on the fantastic work on this project! You can read more about the updates [here](https://blog.rstudio.com/2021/08/23/cheat-sheet-updates/) and find the new cheatsheets [here](https://www.rstudio.com/resources/cheatsheets/).
7070
- **ggplot2 FAQ:** A new resource that might be useful for learners is the FAQ we've recently developed for ggplot2, which you can access [here](https://ggplot2.tidyverse.org/articles/). These were compiled based on popular questions on StackOverflow and RStudio Community. Each question is accompanied with a short answer as well as an expanded example.
7171

7272
## Lifecycle stages
7373

74-
The [**lifecycle**](https://lifecycle.r-lib.org/) package is used to manage the lifecycle of functions and features within the tidyverse, with clear messaging about what is still experimental and what the tidyverse team is moving away from in the future. But instead of focusing on the package that implements this concept, when teaching I recommend focusing on the stages of the lifecycle instead. These are *experimental*, *stable*, *deprecated*, and *superseded*. The lifecycle stages are a useful guide for teaching because they help you see what the tidyverse is moving forward and what it's moving away from. Being aware of the lifecycle stages (and their associated badges) can be helpful as you review and revise your teaching materials or as you consider incorporating new tooling into your teaching.
74+
The [**lifecycle**](https://lifecycle.r-lib.org/) package is used to manage the lifecycle of functions and features within the tidyverse, with clear messaging about what is still experimental and what the tidyverse team is moving away from in the future. But instead of focusing on the package that implements this concept, when teaching, I recommend focusing on the stages of the lifecycle instead. These are *experimental*, *stable*, *deprecated*, and *superseded*. The lifecycle stages are a useful guide for teaching because they help you see what the tidyverse is moving toward and what it's moving away from. Being aware of the lifecycle stages (and their associated badges) can be helpful as you review and revise your teaching materials or as you consider incorporating new tooling into your teaching.
7575

76-
The diagram below depicts the lifecycle of the various stages of functions and packages in the tidyverse.
76+
The diagram below depicts the lifecycle stages of functions and packages in the tidyverse.
7777

7878
![A diagram showing the transitions between the four main stages: experimental can become stable and stable can become deprecated or superseded.](lifecycle.png)
7979

8080
Let's discuss each of these stages in detail, along with recommendations on how you might consider them in the context of teaching:
8181

82-
- <img src="lifecycle-stable.svg" alt="Stable" style="vertical-align:middle"/> Stable indicates that breaking changes will be avoided where possible, and they're only made if the long term benefit of such a change exceeds the short term pain of changing existing code. If breaking changes are needed, they will occur gradually. This is the default state for most functions in the tidyverse and hence the badge is generally not shown. Teaching tip: teach away any stable functions, they're here to stay for the long run!
82+
- <img src="lifecycle-stable.svg" alt="Stable" style="vertical-align:middle"/> Stable indicates that breaking changes will be avoided where possible, and they're only made if the long term benefit of such a change exceeds the short term pain of changing existing code. If breaking changes are needed, they will occur gradually. This is the default state for most functions in the tidyverse and hence the badge is generally not shown. Teaching tip: feel free to teach any stable functions, they're here to stay for the long run!
8383

8484
- <img src="lifecycle-deprecated.svg" alt="Deprecated" style="vertical-align:middle"/> If a function is noted as deprecated, this means a better alternative is available and this function is scheduled for removal. Generally functions will first be soft deprecated and then deprecated. Very important functions that become deprecated might next be defunct, which means that function continues to exist but the deprecation warning turns into an error. An example of a deprecated function is [`tibble::data_frame()`](https://tibble.tidyverse.org/reference/deprecated.html), with the preferred alternative [`tibble::tibble()`](https://tibble.tidyverse.org/reference/tibble.html). Arguments to functions can also be deprecated, e.g., in [`tidyr::nest()`](https://tidyr.tidyverse.org/reference/nest.html) the new argument `new_col` makes the former `.key` argument not needed, and hence `.key` is deprecated. You should avoid teaching functions that are deprecated and correct their usage in your students' code by suggesting the preferred alternative.
8585

@@ -110,13 +110,13 @@ If you'd like to learn more about the tidyverse lifecycle, I recommend the follo
110110

111111
The [**reprex**](https://reprex.tidyverse.org/) package helps users create **repr**oducible **ex**amples for posting to GitHub issues, StackOverflow, in Slack messages or snippets, or even to paste into PowerPoint or Keynote slides by placing the code to be shared in your clipboard. I find reprex very useful when teaching because it helps my students provide me with broken code in a way that makes it as easy as possible for me (and for other students in the class) to help them.
112112

113-
There has been [many](https://reprex.tidyverse.org/news/index.html#reprex-1-0-0-2021-01-27) [exciting](https://reprex.tidyverse.org/news/index.html#reprex-2-0-0-2021-04-02) developments in reprex over the year. The one that is perhaps most relevant to teaching are improvements that make it easier to use reprex when working in [RStudio Server](https://www.rstudio.com/products/rstudio/#rstudio-server) and [RStudio Cloud](https://rstudio.cloud/) as well as those that allow using local data when creating a reprex.
113+
There have been [many](https://reprex.tidyverse.org/news/index.html#reprex-1-0-0-2021-01-27) [exciting](https://reprex.tidyverse.org/news/index.html#reprex-2-0-0-2021-04-02) developments in reprex over the year. The one that is perhaps most relevant to teaching are improvements that make it easier to use reprex when working in [RStudio Server](https://www.rstudio.com/products/rstudio/#rstudio-server) and [RStudio Cloud](https://rstudio.cloud/) as well as those that allow using local data when creating a reprex.
114114

115-
Many courses teache R using RStudio Server or RStudio Cloud since this approach circumvents the need for students to install software and allows the instructor to have full control over the R environment their students are learning in. When working in these environments, the R code is running in a web browser and for security reasons it's not possible for reprex to place code on your system clipboard. When creating a reprex in these environments, you can now simply select the relevant code, and run `reprex()`. This will create a `.md` file containing the contents of the reprex, ready for you to copy via Cmd/Ctrl+C.
115+
Many courses teach R using RStudio Server or RStudio Cloud since this approach circumvents the need for students to install software and allows the instructor to have full control over the R environment their students are learning in. When working in these environments, the R code is running in a web browser and for security reasons it's not possible for reprex to place code on your system clipboard. When creating a reprex in these environments, you can now simply select the relevant code, and run `reprex()`. This will create a `.md` file containing the contents of the reprex, ready for you to copy via Cmd/Ctrl+C.
116116

117117
<img src="reprex-cloud.png" alt="On the left: RStudio Cloud window with an R script with two lines of code highlighted. On the right: Result after running reprex() in the Console, including a new markdown file with the name vivid-eider_reprex.md that includes the code and the resulting output, commented out, and selected, ready to be copy pasted elsewhere. The viewer pane on the bottom right shows the stylized result of the reprex." width="1000"/>
118118

119-
Another development that will help students, particularly those working on an assignment involving a local data file, create reprexes is the new `wd` argument to set working directory of the reprex.[^2] Writing a reproducible example with a minimal dataset is better practice, but this can be quite difficult for new learners. Being able to easily use local data will make it easier for them to benefit from other aspects of reprex earlier on.
119+
The new `wd` argument can help students create reprexes when they are working on an assignment involving a local data file. When `reprex(wd = ".")`, the reprex will be executed in the current working directory.[^2] Writing a reproducible example with a minimal dataset is better practice, but this can be quite difficult for new learners. Being able to easily use local data will make it easier for them to benefit from other aspects of reprex earlier on.
120120

121121
Being able to create a reprex in the current working directory means you can also benefit from a project-level `.Rprofile` if you happen to have one in your project. This is likely not going to have implications for new learners, for whom this would be an advanced concept, but it can be helpful for instructors who teach with a different suite of packages than what they locally have installed (e.g., CRAN versions for teaching vs. development versions for personal use). If this describes you, I recommend using [**renv**](https://rstudio.github.io/renv/index.html) in projects where you keep teaching materials, which uses `.Rprofile` to implement a project-specific package library. Then, `reprex(wd = ".")` will create a reprex using the packages in that library.
122122

@@ -472,7 +472,7 @@ dtplyr translates dplyr pipelines into equivalent data.table code. To start, we
472472

473473
</div>
474474

475-
With recent updates, dtplyr can also translate some tidyr functions to data.table, e.g., [`pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html). In the following example the process is the same: start with [`lazy_dt()`](https://rdrr.io/pkg/dtplyr/man/lazy_dt.html), write a data transformation step using tidyverse code, view the resut with [`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.html), and view the query with [`show_query()`](https://dplyr.tidyverse.org/reference/explain.html).
475+
With recent updates, dtplyr can also translate some tidyr functions to data.table, e.g., [`pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html). In the following example the process is the same: start with [`lazy_dt()`](https://rdrr.io/pkg/dtplyr/man/lazy_dt.html), write a data transformation step using tidyverse code, view the result with [`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.html), and view the query with [`show_query()`](https://dplyr.tidyverse.org/reference/explain.html).
476476

477477
<div class="highlight">
478478

0 commit comments

Comments
 (0)