|
1 | 1 | \name{cbindlist} |
2 | 2 | \alias{cbindlist} |
| 3 | +\alias{setcbindlist} |
3 | 4 | \alias{cbind} |
4 | 5 | \alias{cbind.data.table} |
5 | 6 | \title{Column bind multiple data.tables} |
6 | 7 | \description{ |
7 | 8 | Column bind multiple \code{data.table}s. |
8 | 9 | } |
9 | 10 | \usage{ |
10 | | - cbindlist(l, copy=TRUE) |
| 11 | + cbindlist(l) |
| 12 | + setcbindlist(l) |
11 | 13 | } |
12 | 14 | \arguments{ |
13 | 15 | \item{l}{ \code{list} of \code{data.table}s to merge. } |
14 | | - \item{copy}{ Logical, default \code{FALSE}. If \code{TRUE}, the resulting columns will be a shared reference to the originals, otherwise copies will be made. } |
15 | 16 | } |
16 | 17 | \details{ |
17 | 18 | Column bind only stacks input elements. Works like \code{\link{data.table}}, but takes \code{list} type on input. Zero-column tables in \code{l} are omitted. Tables in \code{l} should have matching row count; recycling of length-1 rows is not yet implemented. Indices of the input tables are transferred to the resulting table, as well as the \emph{key} of the first keyed table. |
18 | 19 | } |
19 | 20 | \value{ |
20 | | - A new \code{data.table} based on the stacked objects. Eventually when \code{copy} is \code{FALSE}, then resulting object will share columns with \code{l} tables. |
| 21 | + A new \code{data.table} based on the stacked objects. |
| 22 | + |
| 23 | + For \code{setcbindlist}, columns in the output will be shared with the input, i.e., \emph{no copy is made}. |
21 | 24 | } |
22 | 25 | \note{ |
23 | | - If output object has any duplicate names, then key and indices are removed. |
| 26 | + No attempt is made to deduplicate resulting names. If the result has any duplicate names, keys and indices are removed. |
24 | 27 | } |
25 | 28 | \seealso{ |
26 | | - \code{\link{data.table}}, \code{\link{rbindlist}} |
| 29 | + \code{\link{data.table}}, \code{\link{rbindlist}}, \code{\link{setDT}} |
27 | 30 | } |
28 | 31 | \examples{ |
29 | 32 | d1 = data.table(x=1:3, v1=1L, key="x") |
30 | 33 | d2 = data.table(y=3:1, v2=2L, key="y") |
31 | 34 | d3 = data.table(z=2:4, v3=3L) |
32 | 35 | cbindlist(list(d1, d2, d3)) |
33 | 36 | cbindlist(list(d1, d1)) |
34 | | -d4 = cbindlist(list(d1), copy=FALSE) |
| 37 | +d4 = setcbindlist(list(d1)) |
35 | 38 | d4[, v1:=2L] |
36 | 39 | identical(d4, d1) |
37 | 40 | } |
|
0 commit comments