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
Doesn't work correctly for a numeric column
library(dplyr, warn.conflicts = FALSE) library(dtplyr) library(tidyr) tibble( id = 1, name = 1:2, value = 11:12 ) %>% lazy_dt() %>% pivot_wider(names_prefix = "col") #> Source: local data table [1 x 3] #> Call: setnames(dcast(`_DT1`, formula = id ~ name, value.var = "value"), #> old = 1:2, new = c("col1", "col2")) #> #> col1 col2 `2` #> <dbl> <int> <int> #> 1 1 11 12 #> #> # Use as.data.table()/as.data.frame()/as_tibble() to access results
Created on 2021-03-04 by the reprex package (v1.0.0)
but works when cast to character before
library(dplyr, warn.conflicts = FALSE) library(dtplyr) library(tidyr) tibble( id = 1, name = as.character(1:2), value = 11:12 ) %>% lazy_dt() %>% pivot_wider(names_prefix = "col") #> Source: local data table [1 x 3] #> Call: setnames(dcast(`_DT1`, formula = id ~ name, value.var = "value"), #> old = c("1", "2"), new = c("col1", "col2")) #> #> id col1 col2 #> <dbl> <int> <int> #> 1 1 11 12 #> #> # Use as.data.table()/as.data.frame()/as_tibble() to access results
The text was updated successfully, but these errors were encountered:
Pivot wider can handle numeric column in names_from (#215)
8ece213
Fixes #214
Successfully merging a pull request may close this issue.
Doesn't work correctly for a numeric column
Created on 2021-03-04 by the reprex package (v1.0.0)
but works when cast to character before
Created on 2021-03-04 by the reprex package (v1.0.0)
The text was updated successfully, but these errors were encountered: