View source: R/mean-by-group.R
dh.meanByGroup | R Documentation |
This has similar functionality to 'tapply' or the dplyr chain 'group_by' 'summarise'. It offers additional flexilibity over 'ds.tapply' in that it allows you to specify upper and lower values for each strata. By contrast, ds.tapply will produce a summary based on every unique value of the grouping variable, which may not always be what is required.
dh.meanByGroup(
df = NULL,
outcome = NULL,
group_var = NULL,
intervals = NULL,
conns = NULL,
checks = FALSE
)
df |
Character specifying a server-side data frame. |
outcome |
String specifying outcome variable within 'df'. |
group_var |
String specifying grouping variable within 'df'. |
intervals |
Optionally, numeric vector defining how to stratify 'group_var'. Values should specify alternately lower and upper values for each strata. If NULL, 'outcome' is summarised by every unique value of 'group_var'. |
conns |
DataSHIELD connections object. |
checks |
Logical; if TRUE checks are performed prior to running the function. Default is TRUE. |
Tibble containing mean values for each strata of 'group_var'.
Other descriptive functions:
dh.anyData()
,
dh.classDiscrepancy()
,
dh.createTableOne()
,
dh.defineCases()
,
dh.getStats()
,
dh.lmTab()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.