Dear R Community,

Below is a problem with a simple ggplot2 graph. The code returns the error
message below.

Error: stat_count() must not be used with a y aesthetic.

My code is below and the data is attached as a ‘text’ file.



# Graph of the probabilities

library(digest)

library(DT)

datatable(probability)

str(probability)

probability$Fertilizer <- as.factor(probability$Fertilizer)

str(probability)

library(ggplot2)

plot1 <- ggplot(probability, aes(x=Fertilizer, y=prob)) +
geom_bar(aes(fill=Treatment))

plot1



Thanks.

Best regards,

James F. Henson
Trt     prob    LL      UL      Fertilizer      Treatment
S0      0.1111  0.0154  0.4998  0       S
S2      0.1111  0.0154  0.4998  2       S
S4      0.1111  0.0154  0.4998  4       S
S6      0.1111  0.0154  0.4998  6       S
P0      0.2222  0.056   0.579   0       P
P2      0.7778  0.4208  0.9439  2       P
P3      0.333   0.1111  0.6665  4       P
P4      0.6667  0.3334  0.8888  6       P
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to