Create a data.table row-wise
rowwiseDT.Rd
rowwiseDT
creates a data.table
object by specifying a row-by-row layout. This is convenient and highly readable for small tables.
Arguments
- ...
Arguments that define the structure of a
data.table
. The column names come from named arguments (likecol=
), which must precede the data. See Examples.
Value
A data.table
. The default is for each column to return as a vector. However, if any entry has a length that is not one (e.g., list(1, 2)
), the whole column will be converted to a list column.
Examples
rowwiseDT(
A=,B=, C=,
1, "a",2:3,
2, "b",list(5)
)
#> A B C
#> <num> <char> <list>
#> 1: 1 a 2,3
#> 2: 2 b 5