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 SET_STRING_ELT error when DT has ordered variables #899

Closed
ChristK opened this issue Oct 19, 2014 · 1 comment
Closed

rbindlist SET_STRING_ELT error when DT has ordered variables #899

ChristK opened this issue Oct 19, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@ChristK
Copy link

ChristK commented Oct 19, 2014

Please see following example:

    require(data.table)
    DT1 = data.table(A = factor(1:2), B = factor(6:10), C = 0)
    DT2 = data.table(D = ordered(1:5), A = factor(1:2), C = 0)
    DT3 = data.table(A = factor(1:2), C = 0)
    l = list(DT1, DT2, DT3)
    rbindlist(l, use.names = T, fill = T)

The above returns:

     #Error in rbindlist(l, use.names = T, fill = T) : 
     # attempt to set index 6/6 in SET_STRING_ELT

When colD in DT2 is a factor instead of ordered factor, rbindlist works as expected:

    DT2 = data.table(D = factor(1:5), A = factor(1:2), C = 0)
    l = list(DT1, DT2, DT3)
    rbindlist(l, use.names = T, fill = T)
     #  A  B C  D
     #1: 1  6 0 NA
     #2: 2  7 0 NA
     #3: 1  8 0 NA
     #4: 2  9 0 NA
     #5: 1 10 0 NA
     #6: 1 NA 0  1
     #7: 2 NA 0  2
     #8: 1 NA 0  3
     #9: 2 NA 0  4
    #10: 1 NA 0  5
    #11: 1 NA 0 NA
    #12: 2 NA 0 NA

Reproducible in R v3.1.1 x64, data.table v1.9.5, Windows 8.1 x64 and LinuxMint x64

@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Oct 19, 2014
@arunsrinivasan arunsrinivasan self-assigned this Oct 19, 2014
@ChristK
Copy link
Author

ChristK commented Oct 19, 2014

Thank you for the super-fast fix

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

2 participants