# Plot the mean chick weight over time
tinyplot(weight ~ Time, data = ChickWeight, type = type_summary())
# mean is the default function, so the above is equivalent to
tinyplot(weight ~ Time, data = ChickWeight, type = type_summary(mean))
# Plot the median instead
tinyplot(weight ~ Time, data = ChickWeight, type = type_summary(median))
# Works with groups and/or facets too
tinyplot(weight ~ Time | Diet, facet = "by", data = ChickWeight, type = type_summary())
# Custom/complex function example
tinyplot(
weight ~ Time | Diet, facet = "by", data = ChickWeight,
type = type_summary(function(y) quantile(y, probs = 0.9)/max(y))
)
Run the code above in your browser using DataLab