Formatting

This commit is contained in:
mine-cetinkaya-rundel 2023-05-09 15:18:44 -04:00
parent b8e3256362
commit 9ef9685618
1 changed files with 7 additions and 5 deletions

View File

@ -56,10 +56,12 @@ string2 <- 'If I want to include a "quote" inside a string, I use single quotes'
If you forget to close a quote, you'll see `+`, the continuation prompt:
> "This is a string without a closing quote
+
+
+ HELP I'M STUCK IN A STRING
```
> "This is a string without a closing quote
+
+
+ HELP I'M STUCK IN A STRING
```
If this happens to you and you can't figure out which quote to close, press Escape to cancel and try again.
@ -205,7 +207,7 @@ df |> mutate(greeting = str_glue("{{Hi {name}!}}"))
### `str_flatten()`
`str_c()` and `glue()` work well with `mutate()` because their output is the same length as their inputs.
`str_c()` and `str_glue()` work well with `mutate()` because their output is the same length as their inputs.
What if you want a function that works well with `summarize()`, i.e. something that always returns a single string?
That's the job of `str_flatten()`[^strings-4]: it takes a character vector and combines each element of the vector into a single string: