Skip to content

Commit

Permalink
Update strings.qmd (hadley#1127)
Browse files Browse the repository at this point in the history
Sorry, these updates are only cosmetic , not on the code. :)

str_glue instead of glue (mistype?)
delimiter instead of delimater
combining instead of combing
  • Loading branch information
jeromecholewa authored Nov 8, 2022
1 parent f6081c4 commit 5bc1a70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions strings.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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, "}")`
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5bc1a70

Please sign in to comment.