My dataset looks like the following, where there is an ID column that is either 1 or 2, then there are several other columns which label several measurements.
ID 1 2 3 ...
1 0.3002 0.05 0.4
2 0.12 0.5 0.32
1 0.05 0.12 0.2
1 0.74 0.12 0.32
I am trying to make a boxplot using ggplot, where x is the non-ID column names, y is the measurements in the table, and the fill is the ID. Here is my current code attempt, but this gives me an error that "Aesthetics must be either length 1 or the same as data":
ggplot(df, aes(x=colnames(df), y=df[,-1], fill=ID)) +
geom_boxplot()
Any help would be appreciated.