Description Usage Arguments Value Examples

View source: R/descriptive-utils.R

This function is a wrapper to `dplyr`

's `summarize`

used with the
`across`

function. For each variable in a set of variables, calculate each
summary statistic from a list of summary statistic functions. Optionally,
group the variables by a grouping variable, and then calculate the
statistics. Optionally, the tibble that is returned by default, which is in a
wide format, can be pivoted to a long format.

1 | ```
describe_across(data, variables, functions, by = NULL, pivot = FALSE)
``` |

`data` |
A data frame |

`variables` |
A vector of variables in |

`functions` |
A list of summary statistic function. If it is named list, which is recommended, the names of the functions will be used to make the names of the returned data frame. |

`by` |
A grouping variable. If included, the |

`pivot` |
A logical variable indicating if the wide format da |

A tibble data frame. If `pivot = F`

, which is the default, the data
frames contains one row per value of the `by`

variable, or just one row overall
if there is no `by`

variable. If `pivot = T`

, there will be `k`

+ 1 columns
if there is no `by`

variable, or `k`

+ 2 columns if there is a `by`

variable,
where `k`

is the number of functions.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
describe_across(faithfulfaces,
variables = c(trustworthy, faithful),
functions = list(avg = mean, stdev = sd),
pivot = TRUE)
describe_across(faithfulfaces,
variables = c(trustworthy, faithful),
functions = list(avg = mean, stdev = sd),
by = face_sex)
describe_across(faithfulfaces,
variables = c(trustworthy, faithful),
functions = list(avg = mean, stdev = sd),
by = face_sex,
pivot = TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.