Hi I'm new to R and could use some help. Im supposed to check some data regarding credit defaults.
To see how defaults are for different ratings by moodys I did the following:
This works quite well actually, however, it does not sort them by the right order of the ranking , which would be Aaa, Aa1,..., instead it does A1, A2,A3, Aaa,.....
Does anybody know how I can rearrange my x-axis, I´ve searched all day but nothing seams to work for my problem.
It says that I´m a new user and therefore can´t upload attachements, I´m sorry.
But it looks like the plot on this page Using R: barplot with ggplot2 | R-bloggers,
just that the y-axis has 0.00, 0.05, 0.10 and the x-axis has A1, A2,A3, Aa1,..... which I want to rearrange, as mentioned to Aaa, Aa1,..... I hope this explenation helps and thank you for your response already.
Below are examples of making a bar plot with a named vector in the order that the elements are stored and in an order determined manually. I think that will work for your data.
#Invent some data with names
Ratings <- c(C=5 ,A=6, B=4)
#plot in the order given
barplot(Ratings)
#Set the plot order manually
barplot(Ratings[c("A","B","C")])