R flag cases with missingness from regression analysis -
Due to the 'missing' in the data, is there any way of re-flagging in R? I would ideally like to remove them from my original dataframe.
Many thanks
glm ()
The model records the line number of the Fit object data, which does not include them for their incompleteness, they are buried in a little but you can recover them in this way:
## Example Data. Frame Some Missing Data DF & lt; - mtcars [1: 6, 1: 5] df [cbind] (1: 5,1: 5)] & lt; - NA DF # MGG Kail Disp HP Draits # Mazda RX 4 NA 6 160 110 3.90 # Mazda Rx 4 Wag 21.0 NA 160 110 3.90 # Datsun 710 22.8 4 NA 93 3.85 # Hornet 4 Drive 21.4 6 258 NA 3.08 # HANGET Sportbout 18.7 8 360 175 NA # Brave 18.1 6 225 105 2.76 ## Fit an example model, and learn which rows are included in the F - LLM (MPG ~ DRAT, weight = DISP, data = DF) As.numeric (na.action (F)) # [1] 1 3 5
Alternatively, the line index PV To accomplish this, use the same strategy as the model.frame () output
:
as.numeric (na.action (model.frame (mpg ~ drat) , Weight = disp, data = df))) # [1] 1 3 5
Comments
Post a Comment