View source: R/desc_stats_by_group.R
| desc_stats_by_group | R Documentation | 
Returns descriptive statistics by group
desc_stats_by_group(
  data = NULL,
  var_for_stats = NULL,
  grouping_vars = NULL,
  stats = "all",
  sigfigs = NULL,
  cols_to_round = NULL
)
| data | a data object (a data frame or a data.table) | 
| var_for_stats | name of the variable for which descriptive statistics will be calculated | 
| grouping_vars | name(s) of grouping variables | 
| stats | statistics to calculate. If  | 
| sigfigs | number of significant digits to round to | 
| cols_to_round | names of columns whose values will be rounded | 
the output will be a data.table showing descriptive statistics of the variable for each of the groups formed by the grouping variables.
desc_stats_by_group(data = mtcars, var_for_stats = "mpg",
grouping_vars = c("vs", "am"))
desc_stats_by_group(data = mtcars, var_for_stats = "mpg",
grouping_vars = c("vs", "am"), sigfigs = 3)
desc_stats_by_group(data = mtcars, var_for_stats = "mpg",
grouping_vars = c("vs", "am"), stats = "basic", sigfigs = 2)
desc_stats_by_group(data = mtcars, var_for_stats = "mpg",
grouping_vars = c("vs", "am"), stats = "basic", sigfigs = 2,
cols_to_round = "all")
desc_stats_by_group(data = mtcars, var_for_stats = "mpg",
grouping_vars = c("vs", "am"), stats = c("mean", "median"), sigfigs = 2,
cols_to_round = "all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.