The following code
df <- data.frame(place = c("South","South","North","East"),
temperature = c(30,30,20,12),
outlookfine=c(TRUE,TRUE,FALSE,FALSE)
)
glm.fit <- glm(outlookfine ~ .,df , family= binomial)
coef.glm <-coef(summary(glm.fit))
coef.glm
outputs
Estimate Std. Error z value Pr(>|z|)
(Intercept) -23.56607 79462.00 -0.0002965703 0.9997634
placeNorth 0.00000 112376.25 0.0000000000 1.0000000
placeSouth 47.13214 97320.68 0.0004842972 0.9996136
I want to re-display the list without the intercept and without places containing the phrase "South"
I thought of trying to name the index column and then subset on it but have had no success.
[Update] I added more data to understand why George Sava's answer also stripped out "North"
df <- data.frame(place = c("South","South","North","East","West"),
temperature = c(30,30,20,12,15),
outlookfine=c(TRUE,TRUE,FALSE,FALSE,TRUE)
)
glm.fit <- glm(outlookfine ~ .,df, family= binomial )
coef.glm <-coef(summary(glm.fit))
coef.glm[!grepl(pattern = ("South|Intercept"), rownames(coef.glm)),]
outputs
Estimate Std. Error z value Pr(>|z|)
placeNorth 3.970197e-14 185277.1 2.142843e-19 1.0000000
placeWest 4.913214e+01 185277.2 2.651818e-04 0.9997884