rowbind | R Documentation |
collapse's version of data.table::rbindlist
and rbind.data.frame
. The core code is copied from data.table, which deserves all credit for the implementation. rowbind
only binds lists/data.frame's. For a more flexible recursive version see unlist2d
. To combine lists column-wise see add_vars
or ftransform
(with replacement).
rowbind(..., idcol = NULL, row.names = FALSE,
use.names = TRUE, fill = FALSE, id.factor = "auto",
return = c("as.first", "data.frame", "data.table", "tibble", "list"))
... |
a single list of list-like objects (data.frames) or comma separated objects (internally assembled using |
idcol |
character. The name of an id-column to be generated identifying the source of rows in the final object. Using |
row.names |
|
use.names |
logical. |
fill |
logical. |
id.factor |
if |
return |
an integer or string specifying what to return. |
a long list or data frame-like object formed by combining the rows / elements of the input objects. The return
argument controls the exact format of the output.
unlist2d
, add_vars
, ftransform
, Data Frame Manipulation, Collapse Overview
# These are the same
rowbind(mtcars, mtcars)
rowbind(list(mtcars, mtcars))
# With id column
rowbind(mtcars, mtcars, idcol = "id")
rowbind(a = mtcars, b = mtcars, idcol = "id")
# With saving row-names
rowbind(mtcars, mtcars, row.names = "cars")
rowbind(a = mtcars, b = mtcars, idcol = "id", row.names = "cars")
# Filling up columns
rowbind(mtcars, mtcars[2:8], fill = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.