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

[R-Forge #5408] as.data.table.table creates names in an incorrect order #43

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@arunsrinivasan
Copy link
Member

Submitted by: Benjamin Barnes; Assigned to: Arun ; R-Forge link

The names of the resulting data.table are in the incorrect order. For example,

set.seed(123)

DT <- data.table(XX = sample(LETTERS[1:5], 1000, replace = TRUE),
    yy = sample(1:5, 1000, replace = TRUE))

as.data.table(DT[, table(XX, yy)])
## Names are c("yy", "XX", "N")
## Should be c("XX", "yy", "N"), as in as.data.frame

sessionInfo()

# R version 3.0.2 (2013-09-25)
# Platform: x86_64-w64-mingw32/x64 (64-bit)

# locale:
# [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
# [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
# [5] LC_TIME=German_Germany.1252    

# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     

# other attached packages:
# [1] data.table_1.9.2

# loaded via a namespace (and not attached):
# [1] plyr_1.8.1     Rcpp_0.11.0    reshape2_1.2.2 stringr_0.6.2  tools_3.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant