Learn R Programming

data.table (version 1.8.8)

rbindlist: Makes one data.table from a list of many

Description

Same as do.call("rbind",l), but much faster.

Usage

rbindlist(l)

Arguments

l
A list of data.table, data.frame or list objects.

Value

  • An unkeyed data.table containing a concatenation of all the items passed in.

Details

Each item of l may be either NULL (skipped), an empty object (0 rows) (skipped), or, have the same number of columns as the first non empty item. All items do not have to be the same type; e.g, a data.table may be bound with a list. The column types of the result are taken from the first non-empty item. If subsequent non-empty items have columns that mismatch in type, they are coerced to the first non-empty item's column types.

See Also

data.table

Examples

Run this code
DT1 = data.table(A=1:3,B=letters[1:3])
    DT2 = data.table(A=4:5,B=letters[4:5])
    l = list(DT1,DT2)
    rbindlist(l)

Run the code above in your browser using DataLab