Open In App

Convert Degree value to Radian value in R Programming – deg2rad() Function

Improve
Improve
Like Article
Like
Save
Share
Report

deg2rad() function in R Language is used to convert the specified degree value to radian value.

Note: This function requires ‘grid’ package to be installed.

Syntax: deg2rad(x)

Parameter:
x: degree value to be converted

Example 1:




# R code to convert degree value 
# to radian value
  
# Loading grid package
library(REdaS)
  
# Calling deg2rad() function
deg2rad(0)
deg2rad(30)
deg2rad(50)


Output:

Loading required package: grid
[1] 0
[1] 0.5235988
[1] 0.8726646

Example 2:




# R code to convert degree value 
# to radian value
  
# Loading grid package
library(REdaS)
  
# Calling deg2rad() function
deg2rad(60)
deg2rad(180)
deg2rad(-60)


Output:

Loading required package: grid
[1] 1.047198
[1] 3.141593
[1] -1.047198

Last Updated : 01 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads