Skip to content

New idcol= argument to cbindlist #7133

@MichaelChirico

Description

@MichaelChirico

2- I suggest adding one more argument to cbindlist, in the spirit of idcol arguement in rbindlist, that prefixes the output column names with the names of the source data when the list of data being joined is named. See below.

l = list(x=data.table(a=1,b=2), y=data.table(a=10,b=20))

$x
       a     b
   <num> <num>
1:     1     2

$y
       d     b
   <num> <num>
1:    10    20

# current/default behavior

cbindlist(l)

       a     b     d     b
   <num> <num> <num> <num>
1:     1     2    10    20

# feature request behavior

cbindlist(l, prefix=TRUE)

     x.a   x.b   y.d   y.b
   <num> <num> <num> <num>
1:     1     2    10    20

Originally posted by @Kamgang-B in #4370 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions