Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
R 中是否有一个函数可以确定一个值是NA、NaN、Inf、-Inf还是不是格式正确的数字?
NA
NaN
Inf
-Inf
你要is.finite
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