I need to plot a histogram graph with six countries in the x axis and their gdp in the y axis, how should I write the qplot function? I use: qplot(x = countrygdp, y = gdp, data = combined, geom = "histogram”) However, it just keep giving me errors saying that I should use stat=“bin” or something. Anyone knows how to solve this?
Asked
Active
Viewed 314 times
1 Answers
0
You should use stat=identity to tell ggplot to use the gdp values without any transformation.
combined <- data.frame(countrygdp=letters[1:6],gdp=runif(6))
library(ggplot2)
qplot(x = countrygdp, y = gdp, data = combined, geom ="histogram",stat="identity")
scoa
- 18,470
- 5
- 59
- 78