From 9ef96856189c737774972ab72b1b345b889de988 Mon Sep 17 00:00:00 2001 From: mine-cetinkaya-rundel Date: Tue, 9 May 2023 15:18:44 -0400 Subject: [PATCH] Formatting --- strings.qmd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/strings.qmd b/strings.qmd index ac224bd..5c614a7 100644 --- a/strings.qmd +++ b/strings.qmd @@ -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: