4

I have a melted dataset containing a column "value" which represent an absolute number which varies with every row of the dataset. I want to display this number in a barchart by country.

p <- ggplot(melted,aes(factor(country),y=as.numeric(value))) + geom_bar() +opts(axis.text.x = theme_text(angle = 90,hjust = 1)) 

all I get is:

Error in pmin(y, 0) : Objekt 'y' not found.

Of course I triple-checked if there was a "value" variable I just can't find what's wrong. If a leave the y=... out I get the observations per country which are the same for every country in my case.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Matt Bannert
  • 27,631
  • 38
  • 141
  • 207
  • Could you please add a small reproducible example? We have no clue how your data even looks like. – Aniko Aug 23 '10 at 14:08

1 Answers1

5

You might need to define the identity statistic in geom_bar().

 ggplot(melted,aes(factor(country),y=as.numeric(value))) + 
        geom_bar(stat = "identity", position = "stack")
JoFrhwld
  • 8,867
  • 4
  • 37
  • 32
  • Thx a bunch. I have to admit I never fully got this concept of stat= ... though I read about it a couple of times. Guess I have to take a closer look (and use less qplot probably). Thx for helping out.. – Matt Bannert Aug 23 '10 at 14:23