Hi, I'm working on following dataset.
> dput(uu5) structure(list(grup = structure(c(1L, 1L, 2L, 2L), .Label = c("1", "2"), class = "factor"), bw_grp = structure(c(1L, 2L, 1L, 2L), .Label = c("0-999", "1000+"), class = "factor"), deaths = c(6L, 13L, 1L, 2L), pop = c(26L, 67L, 41L, 93L), bw = c(500L, 1500L, 500L, 1500L), rates = c(23.0769230769231, 19.4029850746269, 2.4390243902439, 2.1505376344086), pct = c(0.279569892473118, 0.720430107526882, 0.305970149253731, 0.694029850746269), logexpo = c(3.25809653802148, 4.20469261939097, 3.71357206670431, 4.53259949315326), grup1 = c(1, 1, 0, 0)), .Names = c("grup", "bw_grp", "deaths", "pop", "bw", "rates", "pct", "logexpo", "grup1"), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA, -4L), vars = list( grup), labels = structure(list(grup = structure(1:2, .Label = c("1", "2"), class = "factor")), row.names = c(NA, -2L), class = "data.frame", vars = list( grup), drop = TRUE, .Names = "grup"), indices = list(0:1, 2:3), drop = TRUE, group_sizes = c(2L, 2L), biggest_group_size = 2L) When I try; uu4 <- mutate(uu4, logexpo = log(pop), grup1 = as.numeric(group == 1 )) fit <- glm(deaths ~ agegrp + grup1 + offset(log(pop)), data = uu4, family = poisson) coef(summary(fit)) exp(coef(fit)["grup1"]) data.frame(deviance(fit), df=fit$df.residual) deviance(fit)/(fit$null.deviance ~ deviance(fit)) this code, I get an error related to last line: Error in deviance(fit)/(fit$null.deviance ~ deviance(fit)) : non-numeric argument to binary operator What's wrong? How can I correct this problem? Thanks in advance. PS: R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" -- Zeki Çatav http://zekicatav.com <http://zekicatav.tyih.gov.tr> twitter.com/zcatav [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.