fit <- chisq.test(OP,correct=FALSE) fit fit$expected fit$residual