meltData | R Documentation |
Melt a Dataset To Examine All Xs vs Y
meltData(
formula,
data,
tall = c("right", "left"),
vnames = c("labels", "names"),
sepunits = FALSE,
...
)
formula |
a formula |
data |
data frame or table |
tall |
see above |
vnames |
set to |
sepunits |
set to |
... |
passed to |
Uses a formula with one or more left hand side variables (Y) and one or more right hand side variables (X). Uses data.table::melt()
to melt data
so that each X is played against the same Y if tall='right'
(the default) or each Y is played against the same X combination if tall='left'
. The resulting data table has variables Y with their original names (if tall='right'
) or variables X with their original names (if tall='left'
), variable
, and value
. By default variable
is taken as label()
s of the tall
variables.
data table
Frank Harrell
label()
d <- data.frame(y1=(1:10)/10, y2=(1:10)/100, x1=1:10, x2=101:110)
label(d$x1) <- 'X1'
units(d$x1) <- 'mmHg'
m=meltData(y1 + y2 ~ x1 + x2, data=d, units=TRUE) # consider also html=TRUE
print(m)
m=meltData(y1 + y2 ~ x1 + x2, data=d, tall='left')
print(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.