favstats()

favstats()

The favstats() function will compute a set of common summary statistics ("favorite stats") for a given variable, including the five-number summary (minimum, Q1, median/Q2, Q3, maximum), the mean, the standard deviation, the sample size (n), and the number of missing cases.

Example 1:

# Compute the favstats() for Thumb
favstats(~Thumb, data = Fingers)

Example output:

Output of favstats() function for Thumb

Example 2:

# Compute the favstats() for Thumb by Sex
favstats(Thumb ~ Sex, data = Fingers)

Example output:

Output of the favstats() function for Thumb by Sex

    • Related Articles

    • gf_dist()

      The gf_dist() function can graphically overlay a number of different mathematical probability distributions. If we want to overlay the normal distribution, we’ll have to specify that with the argument “norm”, and then enter in the mean and standard ...
    • gf_vline()

      The gf_vline() function will add a vertical line onto a plot. You can plot the line by referencing a value in a data frame (Example 1), or by specifying the point along the axis where the line should run through (Example 2). Example 1: # Save the ...
    • xpnorm()

      The xpnorm() function will generate the probability and z-score for a value (X) based on the mathematical function for a normal distribution. It can do this with just three pieces of information: the border you are interested in, and the mean and ...
    • Five-Number Summary

      The 5-number summary is a way to describe the spread of a distribution around a median. If we start by sorting the values from smallest to largest, then chunk our data into quartiles (four equal groups of data points) we can get the five-number ...