Skip to contents

This function checks each element of a data frame to determine if it is NaN (Not a Number). It returns a logical matrix where each element is TRUE if the corresponding element in the data frame is NaN, and FALSE otherwise.

Usage

# S3 method for class 'data.frame'
is.nan(x)

Arguments

x

A data frame to be checked for NaN values.

Value

A logical matrix of the same dimensions as the input data frame, with TRUE indicating NaN values and FALSE indicating non-NaN values.

Examples

df <- data.frame(a = c(1, NaN, 3), b = c(NaN, 2, NaN))
is.nan(df)
#>       a     b
#> 1 FALSE  TRUE
#> 2  TRUE FALSE
#> 3 FALSE  TRUE