Likely you mean to be using favstats()
. Each of these computes the
mean, standard deviation, quartiles, sample size and number of missing values for a numeric vector,
but favstats()
can take a formula describing how these summary statistics
should be aggregated across various subsets of the data.
fav_stats(x, ..., na.rm = TRUE, type = 7)
numeric vector
additional arguments (currently ignored)
boolean indicating whether missing data should be ignored
an integer between 1 and 9 selecting one of the nine quantile algorithms detailed
in the documentation for stats::quantile()
A vector of statistical summaries
fav_stats(1:10)
#> min Q1 median Q3 max mean sd n missing
#> 1 3.25 5.5 7.75 10 5.5 3.02765 10 0
fav_stats(faithful$eruptions)
#> min Q1 median Q3 max mean sd n missing
#> 1.6 2.16275 4 4.45425 5.1 3.487783 1.141371 272 0
data(penguins, package = "palmerpenguins")
# Note: this is favstats() rather than fav_stats()
favstats(bill_length_mm ~ species, data = penguins)
#> species min Q1 median Q3 max mean sd n missing
#> 1 Adelie 32.1 36.75 38.80 40.750 46.0 38.79139 2.663405 151 1
#> 2 Chinstrap 40.9 46.35 49.55 51.075 58.0 48.83382 3.339256 68 0
#> 3 Gentoo 40.9 45.30 47.30 49.550 59.6 47.50488 3.081857 123 1