The **arccos** function is an inverse of the cos() function. It returns the angle whose cosine is a given number. Means: The angle whose cosine is 0.866 is 30 degrees. Use **arccos **or** acos** function when you know the cosine of an angle and want to know the actual angle.

**acos in R**

The acos() is an inbuilt mathematical R function that returns the radian arccosine of number data. To calculate the arc cosine of the specified radian value, use the acos() function in R programming. The acos() function also returns the value in radians.

**Syntax**

`acos(radian)`

**Parameters**

The acos() function takes radian as an argument.

**Return Value**

The acos() function returns the **arc cosine** value of radian. It is a Numeric value, array, or vector.

**Example**

`acos(1)`

**Output**

`[1] 0`

**Passing a pi to the acos() function**

The **pi **is an inbuilt constant in R programming, and its value is **3.141593**.

Let’s find the pi constant’s **acos()** value.

`acos(pi)`

**Output**

```
[1] NaN
Warning message:
In acos(pi) : NaNs produced
```

You can see that it returns NaN(not a number) in the output.

Let’s see another example of pi.

`acos(pi / 4) `

**Output**

`[1] 0.6674572`

**Applying an acos() function to Vector**

To create a Vector in R, use the c() function. But, first, let’s create a vector and pass that to the acos() function.

```
data <- c(-1, -0.850250, -0.507107, -0.4, 0, 0.4, 0.507107, 0.850250, 1)
acos(data)
```

**Output**

```
[1] 3.1415927 2.5872564 2.1026212 1.9823132 1.5707963 1.1592795 1.0389715
[8] 0.5543363 0.0000000
```

That is it for this tutorial.

**See also**

Krunal Lathiya is an Information Technology Engineer by education and web developer by profession. He has worked with many back-end platforms, including Node.js, PHP, and Python. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language. Krunal has written many programming blogs, which showcases his vast expertise in this field.