Sum(is.na(my.df)) worked as predicted when I used it to determine whether my data frame contained any NAs, but sum(is.nan(my.df)) did not.
My.df - data.frame (a=c(1, 2, 3), b=c(5, NA, NaN)) a. my.df b
1 1 5 2 2 NA\s3 3 NaN\s> (my.df) is.na a b
[1,] TRUE TRUE [2,] TRUE FALSE [3,] TRUE FALSE > a b is.nan(my.df)
sum(is.na(my.df)) = FALSE FALSE
Sum(is.nan(my.df)) = [1] 2
[1] 0
I'm sorry. Is there a justification for the inconsistent actions? Is it a result of poor implementation, or is it deliberate? What does is.nan(my.dfreturn )'s value mean? Is there a solid reason why an entire data frame shouldn't be used with is.nan()?
The parameter types appear to be the same in the documentation for is.na() and is.nan().