I want to calculate the following in R:
sin(52.517°)
and this should be equal to 0.79353. But when I code
sin(52.517)
I get
0.777119
So how can I get the 0.79353. I am not good in math, but I know something is not working with degrees and the radian measure here in R.
From the help page on sin
which you can read by typing in ?sin
in the R console:
Angles are in radians, not degrees (i.e., a right angle is π/2).
So by default, the trigonometric functions take radians as input and not degrees. To get the sin(52.517)
you need to convert those degrees to a radian measure first:
52.517 degrees = 52.517 * (pi/180) = sin(52.517*(pi/180)) = 0.916...
If you do:
sin(52.517*(pi/180))
you get the wanted 0.7935339.