Skip to contents

A function to generate latitudinal bins of a given size for a user-defined latitudinal range. If the desired size of the bins is not compatible with the defined latitudinal range, bin size can be updated to the nearest integer which is divisible into this range.

Usage

lat_bins(size = 10, max = 90, min = -90, fit = FALSE, plot = FALSE)

Arguments

size

numeric. A single numeric value defining the width of the latitudinal bins. This value must be more than 0, and less than or equal to 90 (defaults to 10).

max

numeric. A single numeric value defining the upper limit of the latitudinal range (defaults to 90).

min

numeric. A single numeric value defining the lower limit of the latitudinal range (defaults to -90).

fit

logical. Should bin size be checked to ensure that the entire latitudinal range is covered? If fit = TRUE, bin size is set to the nearest integer which is divisible by the user-input range. If fit = FALSE, and bin size is not divisible into the range, the upper part of the latitudinal range will be missing.

plot

logical. Should a plot of the latitudinal bins be generated?

Value

A dataframe of latitudinal bins of user-defined size.

Developer(s)

Lewis A. Jones

Reviewer(s)

Bethany Allen

Examples

# Generate 20 degrees latitudinal bins
bins <- lat_bins(size = 20)

# Generate latitudinal bins with closest fit to 13 degrees
bins <- lat_bins(size = 13, fit = TRUE)
#> Bin size set to 12 degrees to fit latitudinal range.

# Generate latitudinal bins for defined latitudinal range
bins <- lat_bins(size = 10, max = 50, min = -50)