can't find the fault in my grouped barchart coding

this is my data set:

this is my coding:
library(ggplot2)
alcoholpercentage=rep(0:2, each=4)
embryograding=rep(c("gradeone","gradetwo","gradethree","gradefour"), times=3)
numberofembryos=sample(0:11, 12)
df=data.frame(alcoholpercentage,embryograding,numberofembryos)

df

the number of embryos change when I'm trying to form my dataframe:

alcoholpercentage embryograding numberofembryos
1 0 gradeone 5
2 0 gradetwo 3
3 0 gradethree 11
4 0 gradefour 1
5 1 gradeone 10
6 1 gradetwo 0
7 1 gradethree 2
8 1 gradefour 9
9 2 gradeone 8
10 2 gradetwo 4
11 2 gradethree 6
12 2 gradefour 7

the '=sample' bit is probably wrong as I'm not completely sure how to use that.

Replace this with your embreyo count numbers listed out with commas between them all inside of a c() bracket .

Sample is a function to get a random sample, its not going to be capable of guessing what your observed measurements were.
Alternatively if the counts are in a file , read that file in.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.