Bin a variable and calculate mean an uncertainties in mean

binData(mydata, bin = "nox", uncer = "no2", n = 40, interval = NA,
breaks = NA)

## Arguments

mydata Name of the data frame to process. The name of the column to divide into intervals The name of the column for which the mean, lower and upper uncertainties should be calculated for each interval of bin. The number of intervals to split bin into. The interval to be used for binning the data. User specified breaks to use for binning.

## Value

Retruns a summarised data frame with new columns for the mean and upper / lower 95% confidence intervals in the mean.

## Details

This function summarises data by intervals and calculates the mean and bootstrap 95% confidence intervals in the mean of a chosen variable in a data frame. Any other numeric variables are summarised by their mean intervals.

There are three options for binning. The default is to bon bin into 40 intervals. Second, the user can choose an binning interval e.g. interval = 5. Third, the user can supply their own breaks to use as binning intervals.

## Examples

# how does nox vary by intervals of wind speed?
results <- binData(mydata, bin = "ws", uncer = "nox")

# easy to plot this using ggplot2# NOT RUN {
library(ggplot2)
ggplot(results, aes(ws, mean, ymin = min, ymax = max)) +
geom_pointrange()

# }