Describes a numeric variable by strata of another numeric grouping variable.
Source:R/mean-by-group.R
dh.meanByGroup.Rd
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.
Usage
dh.meanByGroup(
df = NULL,
outcome = NULL,
group_var = NULL,
intervals = NULL,
conns = NULL,
checks = FALSE
)
Arguments
- 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 ofgroup_var
.- conns
DataSHIELD connections object.
- checks
Logical; if TRUE checks are performed prior to running the function. Default is TRUE.
See also
Other descriptive functions:
dh.anyData()
,
dh.classDiscrepancy()
,
dh.createTableOne()
,
dh.getStats()
,
dh.lmTab()