We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It feels like collapse() would be more consistent with glue() (and more convenient) if it returned character(0) if the input has length zero.
collapse()
glue()
character(0)
library(glue) glue("{x}", x = "hi") #> hi glue("{x}", x = character(0)) #> character(0) collapse(x = c("hi", "bye"), last = " and ") #> [1] "hi and bye" collapse(x = c(NULL, "bye"), last = " and ") #> [1] "bye" collapse(x = c("hi", NULL), last = " and ") #> [1] "hi" collapse(x = NULL, last = " and ") #> [1] "" collapse(x = character(), last = " and ") #> [1] ""
The text was updated successfully, but these errors were encountered:
I think this was done deliberately to mimic
paste(collapse = "", character()) #> ""
But I could be easily swayed to return character() here...
character()
Sorry, something went wrong.
It is probably a good philosophy to always return 0 length outputs for 0 length inputs, so I will change this.
b87fdb6
Yeah I was looking to glue to save me from the behaviour of paste(collapse = "", character()). Thanks.
paste(collapse = "", character())
No branches or pull requests
It feels like
collapse()
would be more consistent withglue()
(and more convenient) if it returnedcharacter(0)
if the input has length zero.The text was updated successfully, but these errors were encountered: