list.rbind: Bind all list elements by row

Description Usage Arguments See Also Examples

View source: R/list.do.R

Description

The function binds all list elements by row. Each element of the list is expected to be an atomic vector, data.frame, or data.table. If list elements are also lists, the result can be a list-valued matrix. In this case, list.stack may produce a better result.

Usage

1
list.rbind(.data)

Arguments

.data

list

See Also

list.cbind, list.stack

Examples

1
2
3
4
x <- lapply(1:3,function(i) { c(a=i,b=i^2)})
df <- lapply(1:3,function(i) { data.frame(a=i,b=i^2,c=letters[i])})
list.rbind(x)
list.rbind(df)

Example output

     a b
[1,] 1 1
[2,] 2 4
[3,] 3 9
  a b c
1 1 1 a
2 2 4 b
3 3 9 c

rlist documentation built on Sept. 5, 2021, 5:30 p.m.