Description Usage Arguments Value See Also Examples
expand
transforms a DataFrame object into a new
DataFrame object where the columns specified by the user are
unlisted. The transformed DataFrame object has the same colnames
as the original but typically more rows.
1 2 |
x |
A DataFrame object with list-like columns or a Vector
object with list-like metadata columns (i.e. with list-like columns in
|
colnames |
A |
keepEmptyRows |
A |
A DataFrame object that has been expanded row-wise to match the length of the unlisted columns.
DataFrame objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(IRanges)
aa <- CharacterList("a", paste0("d", 1:2), paste0("b", 1:3), c(), "c")
bb <- CharacterList(paste0("sna", 1:2),"foo", paste0("bar",1:3),c(),"hica")
df <- DataFrame(aa=aa, bb=bb, cc=11:15)
## Expand by all list-like columns (aa, bb), dropping rows with empty
## list elements:
expand(df)
## Expand the aa column only:
expand(df, colnames="aa", keepEmptyRows=TRUE)
expand(df, colnames="aa", keepEmptyRows=FALSE)
## Expand the aa and then the bb column:
expand(df, colnames=c("aa","bb"), keepEmptyRows=TRUE)
expand(df, colnames=c("aa","bb"), keepEmptyRows=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.