diff --git a/strings.qmd b/strings.qmd index ba8de02..5d2bf15 100644 --- a/strings.qmd +++ b/strings.qmd @@ -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.