-
Notifications
You must be signed in to change notification settings - Fork 85
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
paste documentation #138
paste documentation #138
Conversation
There is healthy discussion of Here are the cases I explored:
with results summarized as follows: In order to clarify documentation, I propose
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 💯 I only have a minor comment.
src/library/base/man/paste.Rd
Outdated
\code{\link{character}(0)}. This argument interacts with \code{collapse} | ||
such that under the conditions \code{recycle0} is \code{TRUE} and | ||
\code{collapse} is not \code{NULL}, zero-length arguments instead output as | ||
\code{""} .} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor suggestion on spacing
\code{""} .} | |
\code{""}.} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent catch, thank you so much @trangdata!
src/library/base/man/paste.Rd
Outdated
paste("The value is", val[valid], "-- not so good!") | ||
paste("The value is", val[valid], "-- good: empty!", recycle0=TRUE) # -> character(0) | ||
# zero length arguments recycled as `""` | ||
paste({}, 1:2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would prefer paste(character(), 1:2)
. {}
is concise, but masks two behaviors:
- the empty expression evaluates to
NULL
:identical(NULL, {})
isTRUE
- inputs to
paste()
are cast withas.character()
:identical(as.character(NULL), character())
isTRUE
Using character()
is thus more "minimal" in the sense of demonstrating the behavior more directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out, @MichaelChirico!
No description provided.