开发者

One function to detect NaN, NA, Inf, -Inf, etc.?

开发者 https://www.devze.com 2023-04-06 23:14 出处:网络
Is there a single function in R that determines if a value is NA,开发者_C百科 NaN, Inf, -Inf, or otherwise not a well-formed number?You want is.finite

Is there a single function in R that determines if a value is NA,开发者_C百科 NaN, Inf, -Inf, or otherwise not a well-formed number?


You want is.finite

> is.finite(NA)
[1] FALSE
> is.finite(NaN)
[1] FALSE
> is.finite(Inf)
[1] FALSE
> is.finite(1L)
[1] TRUE
> is.finite(1.0)
[1] TRUE
> is.finite("A")
[1] FALSE
> is.finite(pi)
[1] TRUE
> is.finite(1+0i)
[1] TRUE
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号