-1

I am extremely new to R (Day 2). I am putting together a bargraph but am constantly getting the "non-numeric argument to binary operator. Below is all of the code I have written thus far. Any suggestions? I understand that is the (+) error but am unsure of how to correct it and still receive my graph.

I have attempted to remove the guides(fill=FALSE) but then I do not get a graph just this:

plot <- ggplot(data=sumcult5ml, aes(x=reorder(cultivar,eggs5ml, y=eggs5ml)))

geom_bar(aes(fill="sumcult5ml", TRUE),stat="bin", width=.5)

mapping: x = TRUE, fill = sumcult5ml 

geom_bar: width = 0.5, na.rm = FALSE

stat_bin: width = 0.5, na.rm = FALSE

position_stack

Code:

plot <- ggplot(data=sumcult5ml, aes(x=reorder(cultivar,eggs5ml, y=eggs5ml))) 

geom_bar(aes(fill="sumcult5ml", TRUE),stat="bin", width=.5) + guides(fill=FALSE)

Error:

> plot <- ggplot(data=sumcult5ml, aes(x=reorder(cultivar,eggs5ml, y=eggs5ml)))

> geom_bar(aes(fill="sumcult5ml", TRUE),stat="bin", width=.5) + guides(fill=FALSE)

Error in geom_bar(aes(fill = "sumcult5ml", TRUE), stat = "bin", width = 0.5) +  : 
  non-numeric argument to binary operator

Thank you for any tips!!

Jaap
  • 81,064
  • 34
  • 182
  • 193
R. Med
  • 11
  • 1
  • 1
  • Please consider reading up on [ask] and how to produce a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). You missed a closing bracket, and you need to add geoms to the plot. Not run them separately. – Heroka Jan 30 '16 at 14:46

1 Answers1

1

Add plot elements with the + operator like this:

plot <- ggplot(data=sumcult5ml, aes(x=reorder(cultivar,eggs5ml, y=eggs5ml))) +
  geom_bar(aes(fill="sumcult5ml", TRUE),stat="bin", width=.5) + guides(fill=FALSE)

Note the + at the end of line 1.

Axeman
  • 32,068
  • 8
  • 81
  • 94