Bin a dataset with multiple columns by one of the columns.

1 2 3 |

`dt` |
A data frame containing the data to be binned. |

`bin.size` |
The size of the bins |

`by` |
The name of the column to bin by. |

`bin.average.function` |
The function to use for averaging bins. Default is the arithmetic mean. |

`interpolate` |
Should empty bins be interpolated linearly? |

`remove.na` |
Should NAs remaining after interpolation (usually at endpoints after interpolatin) be removed? BEWARE: be careful about removing nans before interpolating. |

`time.sampled.at` |
How time indices are constructed. Either 'start', 'mid' or 'end' of bins. Defaults to 'mid'. |

`start` |
The minimum value of the 'by' column for which to subset data. Defaults to the first lower bin limit < min(dt[, by]), obeying bin.size. |

`end` |
The maximum value of the 'by' column for which to subset data. Defaults to the first upper bin limit > max(dt[, by]), obeying bin.size. |

`add.binning.info` |
Should info on the binning be added to the resulting dataframe? |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.