data <- as.matrix(data.frame("A" = c(18,7),
"B+" = c(3,2),
"B" = c(3,3),
"C+" = c(6,0),
"C" = c(7,0),
"D" = c(0,4),
"E" = c(5,23)))
barplot (data,
col = c("red","blue"),
beside = TRUE,
xlab = "Grade",
ylab = "Frequency")
legend("topleft",
c("IFC6503-A","IFC6510"),
fill = c("red","blue"),
inset = c(.01,0)
)
I plot two barplot together, the barplot it contain grade, from two different data, the grade is by A B+ B C+ C D E , but the result B+ and C+ is not appear, just appear B. and C. , is my code is wrong or can you guys correct my code?


