parent
3ddf2d0f97
commit
b86b5c6270
|
@ -30,7 +30,6 @@ Imports:
|
|||
tidymodels,
|
||||
tidyverse,
|
||||
tidyr,
|
||||
wakefield,
|
||||
writexl
|
||||
Suggests:
|
||||
downlit,
|
||||
|
|
|
@ -218,7 +218,7 @@ In this book, we'll use five data packages from outside the tidyverse:
|
|||
```{r}
|
||||
#| eval: false
|
||||
|
||||
install.packages(c("gapminder", "Lahman", "nycflights13", "palmerpenguins", "wakefield"))
|
||||
install.packages(c("gapminder", "Lahman", "nycflights13", "palmerpenguins"))
|
||||
```
|
||||
|
||||
These packages provide data on world development, baseball, airline flights, and body measurements of penguins that we'll use to illustrate key data science ideas, while the final one helps generate random data sets.
|
||||
|
|
|
@ -852,7 +852,7 @@ Now imagine that you have a table of employee birthdays:
|
|||
|
||||
```{r}
|
||||
employees <- tibble(
|
||||
name = wakefield::name(100),
|
||||
name = sample(babynames::babynames$name, 100),
|
||||
birthday = lubridate::ymd("2022-01-01") + (sample(365, 100, replace = TRUE) - 1)
|
||||
)
|
||||
employees
|
||||
|
|
|
@ -171,8 +171,7 @@ str_c("Hello ", c("John", "Susan"))
|
|||
`str_c()` is very similar to the base `paste0()`, but is designed to be used with `mutate()` by obeying the usual tidyverse rules for recycling and propagating missing values:
|
||||
|
||||
```{r}
|
||||
set.seed(1410)
|
||||
df <- tibble(name = c(wakefield::name(3), NA))
|
||||
df <- tibble(name = c("Flora", "David", "Terra"))
|
||||
df |> mutate(greeting = str_c("Hi ", name, "!"))
|
||||
```
|
||||
|
||||
|
@ -636,7 +635,8 @@ To avoid this problem, stringr defaults to English rules by using the "en" local
|
|||
Fortunately, there are two sets of functions where the locale really matters: changing case and sorting.
|
||||
|
||||
The rules for changing cases differ among languages.
|
||||
For example, Turkish has two i's: with and without a dot. Since they're two distinct letters, they're capitalized differently:
|
||||
For example, Turkish has two i's: with and without a dot.
|
||||
Since they're two distinct letters, they're capitalized differently:
|
||||
|
||||
```{r}
|
||||
str_to_upper(c("i", "ı"))
|
||||
|
|
Loading…
Reference in New Issue