-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Properly handle cols
argument of measure()
#5064
Conversation
hi @UweBlock @tlapak thanks for the PR/issue. |
or better: "cols: a character vector that is automatically provided, with all of the column names of the data table input to melt. The user should NOT provide this argument; to specify the columns to be measured, use the pattern argument." |
Maybe I'm missing something obvious, but if |
well, I would be all for removing the cols argument, because indeed I don't think the user should ever have to use it. patterns = function(..., cols=character(0L)) { for completeness the cols argument to patterns is documented as follows:
|
Perhaps it could be mentioned along with the default argument to specify that it is not required? To clarify its use further, the help text
or that for the Or, a good way is to mention it identical to the way the |
hi @tlapak would you agree that to move forward we should either close or substantially modify this PR? (remove changes to code, add new docs for cols argument) |
@tdhock, sorry for the long radio silence. I've been a bit swamped. I see what you mean when you say the argument shouldn't have to be used but the original issue also made sense to me. Even if I probably wouldn't have used the argument its presence and documentation is somewhat suggestive. But I didn't mean to step on anyone's toes here. I don't feel super strongly about this but would agree with @MichaelChirico that having an argument exposed that shouldn't be used is not exactly ideal. Maybe it would work to have a public |
ok thanks for the feedback. |
Closes #5063
There are two separate issues reported here. One results from
col
not being properly evaluated at any point. The other from the fact that measure and melt assume that measure was passed the complete list of column names. (measure
returns an index intocols
andmelt
applies that tonames(data)
)The fix feels slightly hacky but seems to be the simplest way of letting
measure()
know about the full list of column names without exposing this interaction to the user. I also think we should check thatcols
is only passed a subset of column names.Todos:
is.character(cols)
further upcols
is a subset ofnames(data)