I'm new in R and coding in general... I have computed multiple anova analysis on multiple columns (16 in total). For that purpose, the method "Purr" helped me :
anova_results_5sector <- purrr::map(df_anova_ch[,3:18], ~aov(.x ~ df_anova_ch$Own_5sector))
summary(anova_results_5sector[[1]])
So the dumbest way to retrieve output (p-value, etc) is the following method
summary(anova_results_5sector$Env_Pillar)
summary(anova_results_5sector$Gov_Pillar)
summary(anova_results_5sector$Soc_Pillar)
summary(anova_results_5sector$CSR_Strat)
summary(anova_results_5sector$Comm)
summary(anova_results_5sector$ESG_Comb)
summary(anova_results_5sector$ESG_Contro)
summary(anova_results_5sector$ESG_Score)
summary(anova_results_5sector$Env_Innov)
summary(anova_results_5sector$Human_Ri)
summary(anova_results_5sector$Management)
summary(anova_results_5sector$Prod_Resp)
I've tried to use a loop :
for(i in 1:length(anova_results_5sector)){
summary(anova_results_5sector$[i])
}
It didn't work, I dont know and did not find how to deal with $ in for loop
Here you have a look of the structure of the output vector Structure of output
I have tried several times with others methods, more or less complicated. Often the examples found online are too simple and does not allow me to adapt to my data. Any tips ?
Thank you and sorry for such an noobie question
$i.e.anova_results_5sector[[i]]orfor (i in anova_results_5sector) { summary(i) }which will loop directly over the elements of your list.print()when using a for loop. So. Better option would belapply(anova_results_5sector, summary)or if you want your results as a tidy dataframe you could dodplyr::bind_rows(lapply(anova_results_5sector, broom::tidy), .id = "var")lapply(anova_results_5sector, summary). Exactly what I was looking for ! Thank youdplyr::bind_rows(lapply(anova_results_5sector, broom::tidy), .id = "var")Thank you so much it's perfect, and I'm learning a lot !