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
dcast.data.table
library(data.table) ; library(reshape2) dcast(df, cumsum(V1 == 0) ~ V1, value.var = 'V2') # Works # cumsum(V1 == 0) 0 1 2 3 4 #1 1 1.052 0.542 0.496 0.402 0.2780 #2 2 5.115 4.329 4.121 4.075 4.0088 dcast(setDT(df), cumsum(V1 == 0) ~ V1, value.var = 'V2') # Doesn't work # Error in dcast.data.table(setDT(df), cumsum(V1 == 0) ~ V1, value.var = "V2") : # Column 'cumsum(V1==0)' not found.
Data set
df <- structure(list(V1 = c(0L, 1L, 2L, 3L, 4L, 0L, 1L, 2L, 3L, 4L), V2 = c(1.052, 0.542, 0.496, 0.402, 0.278, 5.115, 4.329, 4.121, 4.075, 4.0088)), .Names = c("V1", "V2"), class = "data.frame", row.names = c(NA, -10L))
The text was updated successfully, but these errors were encountered:
The next version of dcast will be able to do this.
dcast
I did not know this was even possible with reshape2::dcast. I don't think there are examples showcasing this feature.
reshape2::dcast
Sorry, something went wrong.
25a74df
@arunsrinivasan There was this. :-)
. ~ col
arunsrinivasan
No branches or pull requests
Data set
The text was updated successfully, but these errors were encountered: