Fix/strings probably typos (#1476)

* probably typos

* probably a typo

* a typo
This commit is contained in:
Mitsuo Shiota 2023-05-21 13:02:56 +09:00 committed by GitHub
parent c0c42c9b4f
commit 6c9cfea1e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ So far, you've used a bunch of strings without learning much about the details.
Now it's time to dive into them, learn what makes strings tick, and master some of the powerful string manipulation tools you have at your disposal.
We'll begin with the details of creating strings and character vectors.
You'll then dive into creating strings from data, then the opposite; extracting strings from data.
You'll then dive into creating strings from data, then the opposite: extracting strings from data.
We'll then discuss tools that work with individual letters.
The chapter finishes with functions that work with individual letters and a brief discussion of where your expectations from English might steer you wrong when working with other languages.
@ -155,7 +155,7 @@ Now that you've learned the basics of creating a string or two by "hand", we'll
This will help you solve the common problem where you have some text you wrote that you want to combine with strings from a data frame.
For example, you might combine "Hello" with a `name` variable to create a greeting.
We'll show you how to do this with `str_c()` and `str_glue()` and how you can use them with `mutate()`.
That naturally raises the question of what string functions you might use with `summarize()`, so we'll finish this section with a discussion of `str_flatten()`, which is a summary function for strings.
That naturally raises the question of what stringr functions you might use with `summarize()`, so we'll finish this section with a discussion of `str_flatten()`, which is a summary function for strings.
### `str_c()`
@ -199,7 +199,7 @@ As you can see, `str_glue()` currently converts missing values to the string `"N
You also might wonder what happens if you need to include a regular `{` or `}` in your string.
You're on the right track if you guess you'll need to escape it somehow.
The trick is that glue uses a slightly different escaping technique; instead of prefixing with special character like `\`, you double up the special characters:
The trick is that glue uses a slightly different escaping technique: instead of prefixing with special character like `\`, you double up the special characters:
```{r}
df |> mutate(greeting = str_glue("{{Hi {name}!}}"))
@ -274,7 +274,7 @@ That's because these four functions are composed of two simpler primitives:
- Just like with `pivot_longer()` and `pivot_wider()`, `_longer` functions make the input data frame longer by creating new rows and `_wider` functions make the input data frame wider by generating new columns.
- `delim` splits up a string with a delimiter like `", "` or `" "`; `position` splits at specified widths, like `c(3, 5, 2)`.
We'll return to the last member of this family, `separate_regex_wider()`, in @sec-regular-expressions.
We'll return to the last member of this family, `separate_wider_regex()`, in @sec-regular-expressions.
It's the most flexible of the `wider` functions, but you need to know something about regular expressions before you can use it.
The following two sections will give you the basic idea behind these separate functions, first separating into rows (which is a little simpler) and then separating into columns.