auto_wrap {ggplot2}R Documentation

Wrap summary function

Description

Creates a new function which will operate correctly with stat_summary.

Usage

auto_wrap(f)

Arguments

f function to wrap

Details

stat_summary assumes that summary functions take data.frames as input, and return data frames as output. This function will convert a function that takes a vector of values to the correct format.

Author(s)

Hadley Wickham <h.wickham@gmail.com>

Examples

sum_mean <- auto_wrap(mean)
sum_mean(data.frame(y = 1:10))

[Package ggplot2 version 0.6 Index]