Learn R Programming

iemisc (version 0.9.9)

cosd: Cosine (in degrees) [GNU Octave/MATLAB compatible]

Description

Calculates the value of cosine for each element of x in degrees in a manner compatible with GNU Octave/MATLAB. Zero is returned for any "elements where (x - 90) / 180 is an integer." Source: Eaton.

Usage

cosd(x)

Value

The cosine of each element of x in degrees. Zero for any "elements where (x - 90) / 180 is an integer."

Arguments

x

A numeric vector containing values in degrees

Author

David Bateman (GNU Octave cosd), Irucka Embry

References

John W. Eaton, David Bateman, and Søren Hauberg (2009). GNU Octave version 3.0.1 manual: a high-level interactive language for numerical computations. CreateSpace Independent Publishing Platform. ISBN 1441413006, URL http://www.gnu.org/software/octave/doc/interpreter/. Page 358.

Examples

Run this code
library("iemisc")

# Examples from GNU Octave cosd
cosd(seq(0, 80, by = 10))

cosd(pi * seq(0, 80, by = 10) / 180)

cosd(c(0, 180, 360))

cosd(c(90, 270, 45))


Run the code above in your browser using DataLab