Skip to content
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

Improve dcast guessing? #3551

Open
MichaelChirico opened this issue May 8, 2019 · 0 comments
Open

Improve dcast guessing? #3551

MichaelChirico opened this issue May 8, 2019 · 0 comments
Labels
reshape dcast melt

Comments

@MichaelChirico
Copy link
Member

Current guess behavior:

function(x) {
  if ("value" %chin% names(x))
    return("value")
  if ("(all)" %chin% names(x))
    return("(all)")
  var <- names(x)[ncol(x)]
  message("Using '", var, "' as value column. Use 'value.var' to override")
  return(var)
}
  1. Look for column value
  2. Look for column (all)
  3. Return the last column

When this was created, value.var didn't support multiple values: https://github.com/Rdatatable/data.table/blob/e95b9be0c31113d4a398c58b6231baf8fd7bb4e8/R/fcast.R

At a glance, it seems to me a strictly better version would be to use setdiff(names(x), all.var(formula))

This would be a potentially breaking change, so gathering feedback first.

@jangorecki jangorecki added the reshape dcast melt label Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reshape dcast melt
Projects
None yet
Development

No branches or pull requests

2 participants