wrapdeg: Adjuster of angular values

View source: R/wrapdeg.R

wrapdegR Documentation

Adjuster of angular values

Description

Wraps and adjusts angular values within a given range.

Usage

wrapdeg(deg, min = 0, leftopen = FALSE, rad = FALSE)

Arguments

deg

Numerics. Angular values you want to adjust.

min

A numeric. The minimal value (left limit) of angular range.

leftopen

A logical. Whether to use left-open ranging. By default FALSE, meaning that the range include min but does not include min + 360. When set TRUE, the range now include min instead.

rad

A logical. Whether the values are in radian unit or not.

Details

Angular values (degrees and radians) are one of the popular parameters you need to handle during analyses, especially in visual tasks and 2-D motor tasks. wrapdeg() wraps the given angular values into a given range of degree e.g., from 0 to 360, or from -180 to 180. The range is by default right-opened, i.e., does include the min but does not include min + 360. Left-opening is available when leftopen is set TRUE. It also allows radian operation when rad is TRUE.

Value

Numerics. Angular values adjusted to fit within the given range.

Examples

  d <- c(-120, -45, 0, 90, 180, 360)
  r <- d / 180 * pi
  wrapdeg(d)
  wrapdeg(d, -180)
  wrapdeg(d, -180, leftopen = TRUE)
  wrapdeg(r, -pi, rad = TRUE)


keimochizuki/htb documentation built on June 9, 2025, 10:03 p.m.