Hi!
I'm trying to change the colors of my grouped bar graph but I keep getting this error:
Error in barplot.default(data, col = 1:nrow(data), legend.text = TRUE, :
formal argument "col" matched by multiple actual arguments
data (need to be made into a table I think)
data.frame(
Freq = c(106, 111, 43, 126, 80, 116, 37, 153, 74, 122, 22, 168),
Var1 = as.factor(c("Correct","Incorrect",
"Nomatch","Share","Correct","Incorrect",
"Nomatch","Share","Correct","Incorrect","Nomatch",
"Share")),
Var2 = as.factor(c("99p","99p","99p",
"99p","98p","98p","98p","98p","97p","97p","97p",
"97p"))
)
library(RColorBrewer)
coul <- brewer.pal(4, "Set2")
barplot(data, # Draw barplot with properly aligned legend
col = 1:nrow(data),
legend.text = TRUE,
col = coul,
beside = TRUE,
args.legend = list(x = "topleft",
inset = c(0.01, -0.1)))
If I remove the "col = coul" line, then the bar graph works, but it gives me some standard colors which I want to change.
thank you!!!