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.
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).- min
numeric
. A single numeric value defining the lower limit of the latitudinal range (defaults to -90).- max
numeric
. A single numeric value defining the upper limit of the latitudinal range (defaults to 90).- fit
logical
. Should bin size be checked to ensure that the entire latitudinal range is covered? Iffit = TRUE
, bin size is set to the nearest integer which is divisible by the user-input range. Iffit = 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? IfTRUE
, a plot is generated. Defaults toFALSE
.
Value
A dataframe
of latitudinal bins of user-defined size. The
data.frame
contains the following columns: bin (bin number), min
(minimum latitude of the bin), mid (midpoint latitude of
the bin), max (maximum latitude of the bin).
See also
For equal-area latitudinal bins, see lat_bins_area.
Examples
# Generate 20 degrees latitudinal bins
bins <- lat_bins_degrees(size = 20)
# Generate latitudinal bins with closest fit to 13 degrees
bins <- lat_bins_degrees(size = 13, fit = TRUE)
#> Bin size set to 12 degrees to fit latitudinal range.
# Generate latitudinal bins for defined latitudinal range
bins <- lat_bins_degrees(size = 10, min = -50, max = 50)