Observation deleted due to missingness in R

一笑奈何 提交于 2019-12-12 09:38:09

问题


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 observation deleted due to missingness)

Is there a way in R so that i can identify this one observation?


回答1:


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))



回答2:


There is MWE as well as a solution in this web page : https://stat.ethz.ch/pipermail/r-help/2010-February/227526.html

which(is.na(variable)) as commented by @PeterDee seems to be indeed the solution



来源:https://stackoverflow.com/questions/28429055/observation-deleted-due-to-missingness-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!