Some technical review comments

This commit is contained in:
mine-cetinkaya-rundel 2023-02-21 09:19:55 -05:00
parent 90470aa721
commit a386d47311
3 changed files with 10 additions and 3 deletions

View File

@ -726,7 +726,7 @@ Note the handy pattern for combining ggplot2 and dplyr.
It's a bit annoying that you have to switch from `|>` to `+`, but it's not too much of a hassle once you get the hang of it.
There's another common variation on this pattern that we can see in some data about baseball players.
The following code uses data from the **Lahman** package to compare what proportion of times a player hits the ball vs. the number of attempts they take:
The following code uses data from the **Lahman** package to compare what proportion of times a player gets a hit vs. the number of times they try to put the ball in play:
```{r}
batters <- Lahman::Batting |>

View File

@ -16,6 +16,7 @@ This section describes a few tips on how to get help and to help you keep learni
If you get stuck, start with Google.
Typically adding "R" to a query is enough to restrict it to relevant results: if the search isn't useful, it often means that there aren't any R-specific results available.
Additionally, adding package names like "tidyverse" or "ggplot2" will help narrow down the results to code that will feel more familiar to you as well, e.g., "how to make a boxplot in R" vs. "how to make a boxplot in R with ggplot2".
Google is particularly useful for error messages.
If you get an error message and you have no idea what it means, try googling it!
Chances are that someone else has been confused by it in the past, and there will be help somewhere on the web.
@ -112,6 +113,9 @@ There are three things you need to include to make your example reproducible: re
Finish by checking that you have actually made a reproducible example by starting a fresh R session and copying and pasting your script.
Creating reprexes is not trivial, and it will take some practice to learn to create good, truly minimal reprexes.
However, learning to ask questions that include the code, and investing the time to make it reproducible will continue to pay off as you learn and master R.
## Investing in yourself
You should also spend some time preparing yourself to solve problems before they occur.

View File

@ -273,9 +273,12 @@ knitr::include_graphics("screenshots/rstudio-nav.png")
```{r}
#| eval: false
flights|>filter(dest=="IAH")|>group_by(year,month,day)|>summarize(n=n(),delay=mean(arr_delay,na.rm=TRUE))|>filter(n>10)
flights|>filter(dest=="IAH")|>group_by(year,month,day)|>summarize(n=n(),
delay=mean(arr_delay,na.rm=TRUE))|>filter(n>10)
flights|>filter(carrier=="UA",dest%in%c("IAH","HOU"),sched_dep_time>0900,sched_arr_time<2000)|>group_by(flight)|>summarize(delay=mean(arr_delay,na.rm=TRUE),cancelled=sum(is.na(arr_delay)),n=n())|>filter(n>10)
flights|>filter(carrier=="UA",dest%in%c("IAH","HOU"),sched_dep_time>
0900,sched_arr_time<2000)|>group_by(flight)|>summarize(delay=mean(
arr_delay,na.rm=TRUE),cancelled=sum(is.na(arr_delay)),n=n())|>filter(n>10)
```
## Summary