Calculate arc tangent of a value in R programming – atan2(y, x) function
Last Updated :
10 May, 2020
With the help of atan2(y, x)
method, we can get the arc tangent between x axis and a vector from origin to (x, y) in R programming.
Syntax: atan2(y, x)
Return: Returns the arc tangent value.
Example 1:
x < - c( 2 , 3 , 4 )
gfg < - atan2( 1 , x)
print (gfg)
|
Output:
[1] 0.4636476 0.3217506 0.2449787
Example 2:
x < - c( 2 , 3 , 1 )
gfg < - atan2(pi / 3 , x)
print (gfg)
|
Output:
[1] 0.4823479 0.3358424 0.8084488
Share your thoughts in the comments
Please Login to comment...