0

I have an experiment consisting on testing the time it takes a subject to climb on a branch, we have tested this subjects (males and females) from 2016 to 2019 and someare undergoing treatment A or B. I need to build a barplot comparing the time it took females on each treatment for year 2016, to females on each treatment for year 2017 and so on. Same exact for males.

My data is stored on a data base like this:

Year   Treatment  ID   Sex  Time(Mins)
2016      A       K1    M    1,63
2016      A       H4    F     5
2017      B       J9    F    3,5
2018      ...
2019      ...

I tried using this code where BD is the name of my data base:

barplot(c(mean(BD$Time[bd2016$Sex=="F" & BD$Treatment=="A" & BD$Year=="2019"]),
          (mean(BD$Time[bd2016$Sex=="F" & BD$Treatment=="B" & BD$Year=="2019"]]))),
        ylim= c(0,40), ylab="xx",names=c("A","B"))
MrFlick
  • 195,160
  • 17
  • 277
  • 295
Dany
  • 1
  • 2
    Can you specify the issue in the code. Do you have both datasets with the same number of rows – akrun Jun 30 '21 at 17:46
  • 3
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jun 30 '21 at 17:48

0 Answers0