Function for Tidy chisq.test Output for Visualizing or Filtering P-Values
For data... library(productplots) library(ggmosaic) For code... library(tidyverse) library(broom) I'm trying to create tidy chisq.test output so that I can easily filter or visualize p-values. I'm using the "happy" dataset (which is included with either of the packages listed above) For this example, if I wanted to condition the "happy" variable on all other variables,I would isolate the categorical variables (I'm not going to create factor groupings out of age, year, etc, for this example), and then run a simple function. df<-happy%>%select(-year,-age,-wtssall) lapply(df,function(x)chisq.test