Se tabaja con le tabla de contingencia en la Hoja1 del archivo . Aquí se está copiando la tabla (CTR+C) y se utiliza read.table("clipboard",...)
______________________________________________
a <- read.table("clipboard", h=T)
obs <- cbind(a$FUMA, a$NoFuma)
obs
## [,1] [,2]
## [1,] 172 90
## [2,] 173 346
chi2 <- chisq.test(obs)
chi2
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: obs
## X-squared = 72.424, df = 1, p-value < 2.2e-16
chi2$expected
## [,1] [,2]
## [1,] 115.7362 146.2638
## [2,] 229.2638 289.7362
chi2 <- chisq.test(obs, correct=FALSE)
chi2
##
## Pearson's Chi-squared test
##
## data: obs
## X-squared = 73.729, df = 1, p-value < 2.2e-16