Description Usage Arguments Details Value See Also Examples
Unfolds a folded data.frame, or part thereof.
1 2 |
x |
folded data.frame |
... |
variables to unfold, given as unquoted anonymous names |
sort |
whether to sort the result by groups values |
By default, the entire data.frame is unfolded, possibly giving back something originally passed to fold(). If ... is specified, only selected items (given as anonymous unquoted arguments) are unfolded. Values stored as encodings are converted to factor. The result has a groups attribute: a character vector of column names in the result whose interaction makes rows unique.
class 'unfolded': data.frame with a groups attribute (character)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | library(magrittr)
library(dplyr)
data(eventsf)
eventsf %>% unfold
eventsf %>% unfold(DV,PRED)
x <- events %>%
filter(CMT == 2) %>%
select(ID, TIME, TAD, DV, BLQ, LLOQ, SEX)
x
attr(x,'groups') <- c('ID','TIME')
# less than 10 values of DV, so BLQ looks like an encoding
y <- x %>% fold(meta=list(DV~BLQ,BLQ~LLOQ))
y %>% data.frame
# reducing the tolerance forces BLQ to match by groups (ID, TIME) instead of DV value
z <- x %>% fold(meta=list(DV~BLQ,BLQ~LLOQ),tol=3)
z
# recursive unfold, since LLOQ is an attribute of BLQ, which is an attribute of DV
unfold(y)
unfold(z)
y %>% unfold(DV)
y %>% unfold(BLQ)
y %>% unfold(LLOQ)
y %>% unfold(SEX)
y %>% unfold(TAD)
y %>% unfold(DV,SEX)
y %>% unfold(TAD,SEX)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.