Convert radians to degree / degree to radians

Iris picture Iris · Sep 3, 2015 · Viewed 37k times · Source

Are there build-in functions in R for the conversion of radians to degree and degree to radians?

So far I wrote my one own functions:

rad2deg <- function(rad) {(rad * 180) / (pi)}
deg2rad <- function(deg) {(deg * pi) / (180)}

#test:
rad2deg(pi) #180
rad2deg(2*pi) #360
deg2rad(180) #pi

Answer

Iris picture Iris · Sep 3, 2015

The comment of Pascal was very useful and I found several ones, e.g.

install.packages("NISTunits", dependencies = TRUE)
library(NISTunits)

NISTdegTOradian(180)
NISTradianTOdeg(pi)