Get `chisq.test()$p.value` for several groups using `dplyr::group_by()`

杀马特。学长 韩版系。学妹 提交于 2019-12-01 00:29:43

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
    <fctr>     <dbl>
1     Bajo 0.9004276
2 Muy bajo 0.4777095
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!