由于 R 中的缺失而删除了观察 [英] Observation deleted due to missingness in R
问题描述
我正忙于 R 中的回归模型,我有大约 16 000 个观察值.这些观察之一使我收到以下错误消息,
I am busy with a regression model in R and i have about 16 000 observations. One of these observations causes me to get the following error message,
(1 个观察因缺失而删除)
在 R 中有没有一种方法可以识别这个观察结果?
Is there a way in R so that i can identify this one observation?
推荐答案
如果你的数据在一个 data.frame x
中,并且每一行对应一个观察,那么这个方法是通过 complete.cases(x)
识别完整案例.相反,要在观察中找到缺失值,请执行 !完成.cases(x)
.要找出哪个观察包含缺失值,请执行
If your data is in a data.frame x
, and each row corresponds to an observation, then the way to go about this is to identify complete cases via complete.cases(x)
. Conversely, to find missing values in an observation, do ! complete.cases(x)
. To find out which observation contains missing values, do
which(! complete.cases(x))
这篇关于由于 R 中的缺失而删除了观察的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!