Learn R Programming

ggvis (version 0.4.1)

compute_boxplot: Calculate boxplot values

Description

Calculate boxplot values

Usage

compute_boxplot(x, var = NULL, coef = 1.5)

Arguments

x
Dataset-like object to compute boxplot values. There are built-in methods for data frames, grouped data frames, and ggvis visualisations.
var
Name of variable for which to compute boxplot values. The variable must be continuous.
coef
The maximum length of the whiskers as multiple of the inter-quartile range. Default value is 1.5.

Value

  • A data frame with columns:
  • min_Lower whisker = smallest observation greater than or equal to lower hinge - 1.5 * IQR
  • lower_Lower hinge (25th percentile)
  • median_Median (50th percentile)
  • upper_Upper hinge (75th percentile)
  • max_Upper whisker = largest observation less than or equal to upper hinge + 1.5 * IQR
  • outliers_A vector of values that are outside of the min and max

See Also

layer_boxplots

Examples

Run this code
mtcars %>% compute_boxplot(~mpg)
mtcars %>% group_by(cyl) %>% compute_boxplot(~mpg)

Run the code above in your browser using DataLab