New idcol= argument to cbindlist

Open
#7,133 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by locating cbindlist and comparing its argument handling with rbindlist's idcol behavior. Use the named-list example in the issue to verify prefixed output column names while preserving the existing default behavior.

Written by the indexing model from the issue text.

Description

[rbind|cbind|merge]list

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 https://github.com/Rdatatable/data.table/issues/4370#issuecomment-3041198607

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.