reshapeWide {CornerstoneR} | R Documentation |
Reshape Grouped Data to Wide
Description
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.
Usage
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,
...
)
Arguments
dataset |
[ |
preds |
[ |
resps |
[ |
groups |
[ |
auxs |
[ |
scriptvars |
[ |
return.results |
[ |
... |
[ANY] |
Details
One script variables is summarized in scriptvars
list:
- drop
[
logical(1)
]
Drop missing combinations (TRUE
) or include all (FALSE
). Default isTRUE
.
For details seedcast
.
Value
Logical [TRUE
] invisibly and outputs to Cornerstone or,
if return.results = TRUE
, list
of
resulting data.frame
object:
reshapeWide |
Dataset with reshaped data. |
Examples
# Reshape dataset to wide format:
reshapeWide(Indometh, "time", "conc", "Subject", character(0)
, list(drop = TRUE, aggr.fun = "mean"), return.results = TRUE
)