I\'m trying to conduct a chi square test on several groups within the dplyr frame. The problem is, group_by() %>% summarise() doesn\'t seem to do t
In dplyr you can generally just use unquoted variable names to access the relevant columns, whether you're in a groupby or otherwise. So removing the .$ accessors from .$partido and .$genero which are not needed I get:
foo %>%
group_by(GM) %>%
summarise(pvalue= chisq.test(partido, genero)$p.value)
# A tibble: 2 × 2
GM pvalue
1 Bajo 0.9004276
2 Muy bajo 0.4777095