reshapeWide {CornerstoneR} | R Documentation |
Reshaping grouped data via dcast
to 'wide' format with
rows for each unique combination of group variables. The response are arranged in
separate columns for each datum in predictors. If a combination of groups identifies
multiple rows, the number of rows in a group is returned to CS for the whole dataset
instead of the response variable value.
reshapeWide(
dataset = cs.in.dataset(),
preds = cs.in.predictors(),
resps = cs.in.responses(),
groups = cs.in.groupvars(),
auxs = cs.in.auxiliaries(),
scriptvars = cs.in.scriptvars(),
return.results = FALSE,
...
)
dataset |
[ |
preds |
[ |
resps |
[ |
groups |
[ |
auxs |
[ |
scriptvars |
[ |
return.results |
[ |
... |
[ANY] |
One script variables is summarized in scriptvars
list:
[logical(1)
]
Drop missing combinations (TRUE
) or include all (FALSE
).
Default is TRUE
.
For details see dcast
.
Logical [TRUE
] invisibly and outputs to Cornerstone or,
if return.results = TRUE
, list
of
resulting data.frame
object:
reshapeWide |
Dataset with reshaped data. |
# Reshape dataset to wide format:
reshapeWide(Indometh, "time", "conc", "Subject", character(0)
, list(drop = TRUE, aggr.fun = "mean"), return.results = TRUE
)