I couldn't print ggplots in for
loops.
I tried with or without print()
function, but both didn’t work.
I'd love to see the plots in the plot panels. I do not want to save images like png, tiff or others.
I also wonder how to see all the plots in the plot panel at once not one by one.
for(index in org_kmmse$question_num %>% unique()){
org_kmmse %>% filter(question_num==index) %>%
print(ggplot()+geom_bar(data =., aes(x = answer,fill = diag_nm))+
labs(title = index))
Sys.sleep(2)
}
and I get below error message
Error in max(x) : invalid 'type' (list) of argument`
Where should I change unlist function in the for loop?
P.S. org_kmmse
dimension is 480 by 9