fault in my grouped barchart coding!

this is my dataset:

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)

however, this dataframe completely changes the number of embryos from my original dataset. I think the '=sample' bit is wrong but I'm not completely sure how this works.

thanks!

you can read R's help documentation for available function by the ? symbol in the console

?sample

the purpose of sample is to randomly select from something.
If you have measured data for number of embryos, where is it / what form is it 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.