To calculate the inverse tangent value of the input numeric value in R, use the atan() function.

**atan in R**

The atan() is a built-in R trigonometric function that returns the radian arctangent of number data. In addition, the atan() method is used to calculate the inverse tangent value of the numeric value passed to it as an argument.

**Syntax**

`atan(x)`

**Parameters**

The atan() function takes **x **as an input value.

**Example**

Calculate the inverse tangent of a value.

```
v1 <- -1
v2 <- 0.5
v3 <- 0
atan(v1)
atan(v2)
atan(v3)
```

**Output**

```
[1] -0.7853982
[1] 0.4636476
[1] 0
```

If you pass the 0 to the atan() function, it will return 0.

**Plot the atan() function to a graph**

We can use the seq() function to create a series of values and pass that to the plot() function, which will create a line chart.

```
dt <- seq(-1, 1, by = 0.01)
plot(dt, atan(x), typ = "l", col = "red")
abline(v = 0, lty = 6, col = "blue")
```

**Output**

**Applying atan() function to a Vector**

To define a Vector in R, use the c() function. Then pass that vector to the atan() function.

```
rv <- c(-1, 0.5, 0, 0.5, 1)
atan(rv)
```

**Output**

`[1] -0.7853982 0.4636476 0.0000000 0.4636476 0.7853982`

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

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

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

`atan(pi)`

**Output**

```
[1] 1.262627
```

Let’s see another example of pi.

`atan(pi / 4)`

**Output**

```
[1] 0.6657738
```

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.