Description Usage Arguments Details Examples
Function for stacking a list, where each component of the
list is a data.frame
containing potentially
differing number of rows, but the same number of columns,
and with all columns of equivalent class.
1 2 3 |
list |
a list of data frames, or a list of lists with each element of the same length. |
name |
a name to assign to the column of row names generated. |
make_row_names |
boolean. add a column built from
the row names? Defaults to |
keep_list_index |
boolean; if |
index_name |
a name to assign to the column of indices. |
coerce_factors |
boolean; if |
When stacking data.frames
with row names, they are
passed into a column called row_names
to protect
from problems with non-unique row names, and also to avoid
appending numbers onto these row names as well.
Note that information on factors is lost by default; they will be converted either to characters or their internal integer representations.
1 2 3 4 5 6 7 8 | x <- data.frame( x=c(1, 2, 3), y=letters[1:3], z=rnorm(3), stringsAsFactors=FALSE )
rownames(x) <- c("apple", "banana", "cherry")
y <- data.frame( x=c(4, 5, 6), y=LETTERS[1:3], z=runif(3), stringsAsFactors=FALSE )
rownames(y) <- c("date", "eggplant", "fig")
tmp1 <- stack_list( list(x, y) )
tmp2 <- do.call( rbind, list(x, y) )
rownames(tmp2) <- 1:nrow(tmp2)
all.equal( tmp1[,1:3], tmp2 )
|
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.