spread_degrees: Spread angles to minimum degrees difference

spread_degreesR Documentation

Spread angles to minimum degrees difference

Description

Spread angles to minimum degrees difference

Usage

spread_degrees(
  degrees,
  min_degrees = 10,
  iteration = 1,
  max_iterations = 20,
  verbose = FALSE,
  ...
)

Arguments

degrees

numeric vector of angles in degrees, expected to range from 0 to 360. Values are fit to the range c(0, 360) using degrees %% 360.

min_degrees

numeric indicating the minimum angle in degrees to allow between adjacent angles.

...

additional arguments are ignored.

Details

The function takes a vector of angles in degrees, and adjusts any angles with adjacent angle below a minimum angle min_degrees until the minimum angle is min_degrees. If all input angles fit this criteria, it is returned unchanged, otherwise it will adjust angles then iteratively call itself until the condition is met.

If all angles are less the min_degrees degrees from the nearest adjacent angle, then all angles are equally spaced around 360 degrees.

See Also

Other venndir spatial: degrees_to_adj(), diff_degrees(), display_angles(), mean_degree_arc(), mean_degrees(), rescale_coordinates()

Examples

degrees <- c(5, 10, 15, 100, 105, 110, 200, 300, 358);
degrees
spread_degrees(degrees);

degrees2 <- sample(degrees);
degrees2
spread_degrees(degrees2);


jmw86069/venndir documentation built on Nov. 14, 2024, 10:12 a.m.