Validates the angle column, optionally converts degrees to radians, and
marks the data frame with class headings_frame and attributes that
downstream functions (stack_headings,
add_stacked_headings, radiate) will use as
defaults.
Arguments
- data
A data frame containing the angle column.
- col
Unquoted or quoted name of the angle column.
- units
Units of the angle column:
"radians"or"degrees". No default — must be specified. Values are converted to radians in place when"degrees".- angle_convention
"unit_circle"(0 = East, CCW, default) or"clock"(0 = North, CW).- coords
"absolute"(default) or"relative".
Value
A data.frame with additional class "headings_frame"
and attributes heading_col, angle_convention,
coords.
See also
stack_headings, add_stacked_headings,
radiate
Examples
d <- data.frame(trial = 1:5, angle = c(10, 45, 80, 350, 20))
hf <- headings_frame(d, angle, units = "degrees")
hf
#> # A tibble: 5 × 2
#> trial angle
#> <int> <dbl>
#> 1 1 0.175
#> 2 2 0.785
#> 3 3 1.40
#> 4 4 6.11
#> 5 5 0.349
