我想尝试两件事:
- 如何删除包含 NA/NaN/Inf 的行?
- 如何将数据点的值从 NA/NaN/Inf 设置为 0?
到目前为止,我已经尝试使用以下代码来处理 NA 值,但是一直收到警告信息。
> eg <- data[rowSums(is.na(data)) == 0,]
Error in rowSums(is.na(data)) :
'x' must be an array of at least two dimensions
In addition: Warning message:
In is.na(data) : is.na() applied to non-(list or vector) of type 'closure'
data
,这也是utils
包中的一个函数。也就是说,您在对一个函数调用is.na
,这是没有意义的。 - Joshua Ulrich