Hi ggplot users,
I have a dataframe,
> df1
id month A B C
1 ben 1 65 21 54
2 ben 2 66 23 55
3 ben 3 54 24 56
4 cort 4 44 23 53
5 cort 5 67 22 52
6 cort 6 66 21 50
7 jam 1 45 20 51
8 jam 2 56 19 57
9 art 1 40 25 58
10 art 2 39 24 53
11 art 6 56 19 54
12 art 7 55 20 52
13 art 8 67 21 50
I want to draw a boxplot for column A. My code is like this:
df1 = read.csv('~/Desktop/data1.csv',header=T)
boxplot1 = ggplot(data=df1,aes(x=factor(id),y=A))+geom_boxplot()
show(boxplot1)
In the figure, the objects on the x-axis appear alphabetically, which means that they appear in the order: art, ben, cort, jam. How to remove the order? I want the objects to appear according to the order in the original dataset: ben, cort, jam, art. Thanks for your help.