更新时间:2023-02-18 11:55:40
由于没有人觉得适合指出为什么你正在尝试什么不工作:
Since nobody so far felt fit to point out why what you're trying doesn't work:
NA == NA
不返回 TRUE
,它返回 NA
(因为与未定义的值相比应该会产生未定义的结果)。 apply
。您不能使用 apply
来循环列中的元素。 a $ x
中,这只是列NA == NA
doesn't return TRUE
, it returns NA
(since comparing to undefined values should yield an undefined result). apply
on an atomic vector. You can't use apply
to loop over the elements in a column. a$x
, which is just the column (an atomic vector).我将修复3.获取 a $ x [is.na a $ x)]< - 0