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

rbindlist use.names=TRUE returns random column order when ncol>255 #3373

Closed
mattdowle opened this issue Feb 8, 2019 · 2 comments · Fixed by #3455
Closed

rbindlist use.names=TRUE returns random column order when ncol>255 #3373

mattdowle opened this issue Feb 8, 2019 · 2 comments · Fixed by #3455
Milestone

Comments

@mattdowle
Copy link
Member

mattdowle commented Feb 8, 2019

Follow up to #3306. The printing issue there is fixed by not using use.names=TRUE in that case. But rbindlist in general still has the issue. Also see: #3352 (comment)

minimal example:

ncol = 30
DT = setDT(replicate(ncol, rnorm(3L), simplify = FALSE))
identical(colnames(rbind(DT[1], DT[3])), colnames(DT))
# [1] TRUE


ncol = 300
DT = setDT(replicate(ncol, rnorm(3L), simplify = FALSE))
identical(colnames(rbind(DT[1], DT[3])), colnames(DT))
# [1] FALSE
@ChristK
Copy link

ChristK commented Feb 8, 2019

Possibly related...
rbind changes column order when there are duplicate column names

require(data.table) #v1.12.1 built 2019-02-08 09:09:06 UTC;
dt1 <- data.table(a=1, b=2, c=3, b=4)
dt2 <- data.table(a=1, b=2, c=3, b=4)
rbind(dt1, dt2, use.names = TRUE) # use.names = FALSE does not reorder the columns
# a b b c
# 1: 1 2 4 3
# 2: 1 2 4 3

@MichaelChirico
Copy link
Member

MichaelChirico commented Feb 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants