0

I want two bars for each day of the week -- one for presence of behavior (logical > 0) and one for absence of behavior ( == 0) according to my data.

Right now I'm using the following, but it is graphing a single bar, which takes into account the zeros in my data. Would like to do this grouped bar as simply as possible (or without much modification to current code)

Data$weekday <- factor(Data$weekday, levels= c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday"))
y <- by(Data$Variable, EMA$weekday, mean, na.rm = TRUE) 
barplot(y, main = "title", ylab = "axis label")
zx8754
  • 52,746
  • 12
  • 114
  • 209
Jason Bu
  • 11
  • 2
  • 1
    Please provide a reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Djork Mar 21 '17 at 08:36
  • `y <- by(Data$Variable, interaction(EMA$weekday, Data$behaviour), mean, na.rm = TRUE)` –  Mar 21 '17 at 08:51

0 Answers0