deg2rad: Converts degrees to radians

View source: R/deg2rad.R

deg2radR Documentation

Converts degrees to radians

Description

Returns a vector after converting degrees to radians.
When overlap is set to TRUE, output is contained within the [-pi, pi] set.

Usage

deg2rad(deg, overlap = T)
deg2rad(deg)

Arguments

deg

Numeric vector containing the angle values in degrees.

overlap

A binary bit, set to FALSE by default.
When set to TRUE, forces the outputs within the [-pi, pi] set.

Details

Input argument "deg" must be a numeric vector.
Input argument "overlap" must be a vector of dimension equal to unity.
Input argument "overlap" must be of logical type.

Value

The returned value is always a vector of the same length as the argument "deg"

Author(s)

Chitran Ghosal

Examples

#test code for positive
test_pos <- NULL
for (i in 1:12) {
  test_pos <- c(test_pos, i*60)
}

v_pos <- deg2rad(test_pos, overlap = T)
test_pos
v_pos


#test code for negative
test_neg <- NULL
for (i in 1:12) {
  test_neg <- c(test_neg, -i*60)
}

v_neg <- deg2rad(test_neg, overlap = T)
test_neg
v_neg

Chitran1987/StatsChitran documentation built on Feb. 23, 2025, 8:30 p.m.