rstudio/gigvis — pull request #3 by wch (2013-06-13 07:10:05+00:00)
Title: Add inter-group coordination to transform_bin

This adds inter-group coordination to `transform_bin`, so that when there are multiple groups, they'll have the same binning boundaries. It's probably easier to look at the changed transform_bin.R file, rather than the diff.

This dispatches on the transform (via `apply_transform`) and then the data object type (via `compute_transform_bin`).

The inter-group determination of binwidth is done in `apply_transform.transform_bin`. @hadley, do you think we should have a pattern of functions that makes it more clear when it does inter-group operations vs. intra-group operations? I'm thinking of ggplot2, where each stat has `calculate_groups()` and `calculate()`. The way it's done here doesn't have that clear a delineation.

Other notes:
* The inter-group coordination could be added as an option to the transform (this may be useful for faceted plots).
* It would be nice to have a data-type-agnostic way of checking a variable's type. For example, in `apply_transform.transform_bin`, I want to do `is.numeric(data[[xvar]])`, but that only works for data frames; it fails for `split_data_dflist` objects.