-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glue()
and glue_data()
documentation inaccurate on what trimming happens
#267
Comments
UpdateSorry, checked some other things. Seems that the only trimming is on leading and trailing blank lines, and not on "whitespace" as typically defined. See below reprex. library(glue)
glue(" {letters[1:3]}")
#> a
#> b
#> c
glue("{letters[1:3]} ")
#> a
#> b
#> c
identical(as.character(glue("{letters[1:3]} ")), c("a ", "b ", "c "))
#> [1] TRUE
glue("\n{letters[1:3]}")
#> a
#> b
#> c
glue("{letters[1:3]}\n")
#> a
#> b
#> c Created on 2022-04-16 by the reprex package (v2.0.1) |
Update 2Some more confusing examples: library(glue)
glue("\n {letters[1:3]}")
#> a
#> b
#> c
glue(" {letters[1:3]}")
#> a
#> b
#> c Created on 2022-04-16 by the reprex package (v2.0.1) |
Looks like this has already been clarified in https://glue.tidyverse.org/reference/trim.html |
I'm also having trouble understanding what
|
The help file for
glue()
andglue_data()
has:but calls the
trim()
function by default (when.trim == TRUE
), which states:Recommended fix
Update the documentation -- adjust the text to indicate that both leading and trailing whitespace and blank lines are automatically trimmed
The text was updated successfully, but these errors were encountered: