Learn R Programming

Kmisc (version 0.2.0)

kStackList: Stack a List of DataFrame-like Objects

Description

Function for stacking a list, where each component of the list is a data.frame or a matrix containing potentially differing number of rows, but the same columns. The main 'extra' is handling of row names, which are passed on into the stacked data frame. These are passed into a column called which to protect from problems with non-unique row names, and also to avoid appending numbers onto these row names as well.

Usage

kStackList(list, which = TRUE)

Arguments

list
a list of data.frames
which
boolean. add a column which built from row names?

Examples

Run this code
x <- data.frame( x=c(1, 2, 3) )
rownames(x) <- c("apple", "banana", "cherry")
y <- data.frame( x=c('a', 'b', 'c') )
rownames(y) <- c("date", "eggplant", "fig")
kStackList( list(x, y) )

Run the code above in your browser using DataLab