Skip to content
Prev 12922 / 29559 Next

GWAR - R

On Sun, 25 Sep 2011, Inaki Sagarzazu wrote:

            
You cannot fit a linear model with missing info either, those cases get 
dropped.
Assuming that the data only contain variables that are relevant for the 
model, create a logical vector and subset in the usual way:

cc <- complete.cases(as(myshp, "data.frame"))
myshp_cc <- myshp[cc,]

If there are other unused variables with NAs that may lead you to drop 
more observations than necessary, create a new object with only the 
relevant columns first:

names(myshp0)
myshp <- myshp0[, c(1,3,5,7)]

if c(1,3,5,7) are the variables you want - you can use names in a vector 
too.

Hope this helps,

Roger