# Check if the elements of a Vector are Finite, Infinite or NaN values in R Programming – is.finite(), is.infinite() and is.nan() Function

`is.finite()` function in R Language is used to check if the elements of a vector are Finite values or not. It returns a boolean value for all the elements of the vector.

Syntax: is.finite(x)

Parameters:
x: Vector to be checked

Example:

 `# R program to illustrate ` `# the use of is.finite() function ` ` `  `# Creating a vector ` `x <``-` `c(``1``, ``2``, ``3``, ``4``, ``5``, NA, ``6``, ``7``) ` ` `  `# Calling is.finite() function ` `is``.finite(x) `

Output:

```  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE
```

#### is.infinite() Function

`is.infinite()` Function in R Language is used to check if the vector contains infinite values as elements. It returns a boolean value for all the elements of the vector.

Syntax: is.infinite(x)

Parameters:
x: Vector to be checked

Example:

 `# R program to illustrate ` `# the use of is.infinite() function ` ` `  `# Creating a vector ` `x <``-` `c(``1``, ``2``, Inf, ``4``, ``-``Inf, ``6``) ` ` `  `# Calling is.infinite() function ` `is``.infinite(x) `

Output:

``` FALSE FALSE  TRUE FALSE  TRUE FALSE
```

#### is.nan() Function

`is.nan()` Function in R Language is used to check if the vector contains any NaN(Not a Number) value as element. It returns a boolean value for all the elements of the vector.

Syntax: is.nan(x)

Parameters:
x: Vector to be checked

Example:

 `# R program to illustrate ` `# the use of is.nan() function ` ` `  `# Creating a vector ` `x <``-` `c(``1``, ``2``, ``-``Inf, NaN, NaN, NaN) ` ` `  `# Calling is.nan() function ` `is``.nan(x) `

Output:

``` FALSE FALSE FALSE  TRUE  TRUE  TRUE
```

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.