You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the glue function returns character(0) when one of the variables to be evaluated has length 0 and is not NULL. The NULL case is already handled by the .null parameter. However, the behaviour with length 0 objects can be confusing and potentially lead to unintended consequences.
I propose adding a new feature that properly handles length 0 variables in the glue function. This feature should provide a clear and consistent behaviour for dealing with length 0 objects, making it easier for users to understand and work with the output in such cases.
I have already implemented a working solution with test cases using an additional parameter, analogous to .null. I would like to contribute it to the tidyverse/glue package. Before creating a pull request, I wanted to open an issue to discuss the potential changes, gather feedback, and ensure that the new feature aligns with the project's goals and guidelines.
Please let me know your thoughts on this proposed feature, and if it's something you'd be interested in incorporating into the tidyverse/glue package.
Current implementation:
n1<-"foo"n2<-character()
res<-glue::glue("{n1} and {n2} go together")
print(res)
#Output: character(0)
Suggested implementation:
n1<-"foo"n2<-character()
res<-glue::glue("{n1} and {n2} go together", .empty="bar")
print(res)
#Output: "foo and bar go together"
The text was updated successfully, but these errors were encountered:
Currently, the glue function returns character(0) when one of the variables to be evaluated has length 0 and is not NULL. The NULL case is already handled by the .null parameter. However, the behaviour with length 0 objects can be confusing and potentially lead to unintended consequences.
I propose adding a new feature that properly handles length 0 variables in the glue function. This feature should provide a clear and consistent behaviour for dealing with length 0 objects, making it easier for users to understand and work with the output in such cases.
I have already implemented a working solution with test cases using an additional parameter, analogous to .null. I would like to contribute it to the tidyverse/glue package. Before creating a pull request, I wanted to open an issue to discuss the potential changes, gather feedback, and ensure that the new feature aligns with the project's goals and guidelines.
Please let me know your thoughts on this proposed feature, and if it's something you'd be interested in incorporating into the tidyverse/glue package.
Current implementation:
Suggested implementation:
The text was updated successfully, but these errors were encountered: