# sin in R: How to Use sin() Function in R

In mathematics, the sine is a trigonometric function of an angle. For example, the sine of an acute angle is defined in the context of a right triangle. For the specified angle, it is the ratio of the length of the side opposite that angle to the length of the longest side of the triangle.

## sin in R

The sin() is a built-in mathematical R function that computes the sine value of the input numeric value. The sin() method accepts a numeric value as an argument and returns the sine value.

To calculate the sine of a value in R programming, use the sin() function.

### Syntax

``sin(x)``

### Parameters

The sin() function accepts x as a parameter.

### Example

``````a1 <- -120
a2 <- 90

sin(a1)
sin(a2)``````

#### Output

`````` -0.5806112
 0.8939967``````

## Passing pi to the sin() function

The pi is an inbuilt R constant. Let’s pass the pi to the sin() function and see the output.

``````a1 <- pi / 2
a2 <- -pi / 3

sin(a1)
sin(a2)``````

#### Output

`````` 1
 -0.8660254``````

## Applying sin() function to a Vector

To define a vector in R, use the c() function. Pass this newly created vector to the sin() function.

``````rv <- c(pi / 2, - pi / 2, pi, pi / 3)
sin(rv)``````

#### Output

`` 1.000000e+00 -1.000000e+00 1.224647e-16 8.660254e-01``

That is it for the sin() function in the R language.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8296558,"math_prob":0.9893149,"size":1608,"snap":"2022-27-2022-33","text_gpt3_token_len":450,"char_repetition_ratio":0.15897755,"word_repetition_ratio":0.006993007,"special_character_ratio":0.30037314,"punctuation_ratio":0.112094395,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9998654,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-07T08:25:00Z\",\"WARC-Record-ID\":\"<urn:uuid:2796f4d8-93d5-406f-a391-f7d3b1968dfd>\",\"Content-Length\":\"112226\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8abe7c49-fa67-464c-bf7f-ad3ae301d7b4>\",\"WARC-Concurrent-To\":\"<urn:uuid:f2a125f2-203c-4823-9f74-861dcb49a08f>\",\"WARC-IP-Address\":\"143.198.65.47\",\"WARC-Target-URI\":\"https://r-lang.com/r-sin-function-with-example/\",\"WARC-Payload-Digest\":\"sha1:FYK6Y3M4KLVYSNPA2CQPL52VYITBZA24\",\"WARC-Block-Digest\":\"sha1:JUGVFO6ODZV7GASHNUOSSNGN5P3MZYAW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104683708.93_warc_CC-MAIN-20220707063442-20220707093442-00234.warc.gz\"}"}