rad2deg: Converts radians to degrees

View source: R/rad2deg.R

rad2degR Documentation

Converts radians to degrees

Description

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

Usage

rad2deg(rad, overlap = T)
rad2deg(rad)

Arguments

rad

Numeric vector containing the angle values in radians.

overlap

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

Details

Input argument "rad" 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 "rad"

Author(s)

Chitran Ghosal

Examples

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

v_pos <- rad2deg(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*pi/3)
}

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

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