Am running these lines of code in the source, and then click “Run” in Rstudio.
fill_colors <- c()
for(i in 1:length(hotdogs$Country) ) {
if (hotdogs$Country[i] == "United States") {
fill_colors <- c(fill_colors, "#821122")
} else {
fill_colors <- c(fill_colors, "cccccc")
}
}
The code gets passed down to the console, but for some reason, the plot doesn’t change.
Any idea why?
If you’re following http://www.cs.odu.edu/~mweigle/cs795/barchart-r.html:
I suspect you haven’t run the line directly after it, which is:
Running only the lines you’ve given will generate a vector
fill_colors, but you need to use that as a parameter forfillinbarplot.