expand {IRanges} | R Documentation |
Expand an object with compressed columns such that all compressed values are represented as separate rows.
## S4 method for signature 'DataFrame' expand(x, colnames, keepEmptyRows, ...)
x |
A |
colnames |
A |
keepEmptyRows |
A |
... |
Arguments passed to other methods. |
A DataFrame
that has been expanded row-wise to match the dimension
of the uncompressed columns.
Herve Pages and Marc Carlson
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 the aa column only, and keep rows adjacent to empty values expand(df, colnames="aa", keepEmptyRows=TRUE) ## expand the aa column only but do not keep rows expand(df, colnames="aa", keepEmptyRows=FALSE) ## expand the aa and then the bb column, but ## keeping rows next to empty compressed values expand(df, colnames=c("aa","bb"), keepEmptyRows=TRUE) ## expand the bb and then the aa column, but don't keep rows adjacent to ## empty values from bb and aa expand(df, colnames=c("aa","bb"), keepEmptyRows=FALSE)