Update strings.qmd (#1127)

Sorry, these updates are only cosmetic , not on the code. :)

str_glue instead of glue (mistype?)
delimiter instead of delimater
combining instead of combing
This commit is contained in:
jeromecholewa 2022-11-08 11:42:20 -05:00 committed by GitHub
parent f6081c4153
commit 5bc1a702e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -255,7 +255,7 @@ df |>
a. `str_c("The price of ", food, " is ", price)`
b. `glue("I'm {age} years old and live in {country}")`
b. `str_glue("I'm {age} years old and live in {country}")`
c. `str_c("\\section{", title, "}")`
@ -273,7 +273,7 @@ If you look closely you can see there's a common pattern here: `separate_`, then
That's because these four functions are composed from two simpler primitives:
- `longer` makes input data frame longer, creating new rows; `wider` makes the input data frame wider, generating new columns.
- `delim` splits up a string with a delimater like `", "` or `" "`; `position` splits at specified widths, like `c(3, 5, 2)`.
- `delim` splits up a string with a delimiter like `", "` or `" "`; `position` splits at specified widths, like `c(3, 5, 2)`.
We'll come back the last member of this family, `separate_regex_wider()`, in @sec-regular-expressions.
It's the most flexible of the `wider` functions but you need to know something about regular expression before you can use it.
@ -453,7 +453,7 @@ df |>
This section discusses stringr functions that work with individual letters.
This is straightforward for English because it uses an alphabet with 26 letters, but things rapidly get complicated when you move beyond English.
Even languages that use the same alphabet but add additional accents (e.g. å, é, ï, ô, ū) are non-trivial because those letters might be represented as an individual character or by combing an unaccented letter (e.g. e) with a diacritic mark (e.g. ´).
Even languages that use the same alphabet but add additional accents (e.g. å, é, ï, ô, ū) are non-trivial because those letters might be represented as an individual character or by combining an unaccented letter (e.g. e) with a diacritic mark (e.g. ´).
And other languages "letters" look quite different: in Japanese each "letter" is a syllable, in Chinese each "letter" is a complex logogram, and in Arabic letters look radically different depending on their location in the word.
In this section, we'll assume that you're working with English text as we introduce to functions for finding the length of a string, extracting substrings, and handling long strings in plots and tables.