I'm trying to automate the generation of several segmented bar plots. There are thirteen variables that I'm trying to loop over, named as per the following convention: mc_q#. I'm trying the following code, but all it does is generate a plot called px and then stop running:
for (x in 1:13) {
px <- ggplot(tct_tqi,
aes(x = mc_qx,
fill = test_category)) +
geom_bar(position = "fill") +
labs(fill="TCT mark band")
}
Will be grateful for any help!!