I want to introduce some element into my loop that sort all bars of the bar plots higher to lower, the loop I wrote is the following (it plots bar plots of all the variables of my dataframe and saves them in a list):
bar_list <- list()
for(i in names(X4)) {
bar_list[[i]] = ggplot(X4, aes(x=Country, y=X4[,i])) + geom_bar(stat = "identity") + labs(y=names(X4[,i])) + theme(axis.text.x = element_text(angle = 90, size = 6))}
bar_list$NI1_3gcoverage
Someone can help me to introduce an element into the loop that reorder bars of the plots higher to lower to each plot?
Thanks for help.