title: How to create a bar plot with dynamic variables for each group and stand error bars included?
body: <p>I try to create a dynamic bar chart with an exact same format as this <a href="https://i.stack.imgur.com/fsvAW.png" rel="nofollow noreferrer">model graph</a> here using R. Unfortunately, my teacher did not provide us with the R codes for the model graph and therefore this dynamic bar chart is taking me hours and hours and I still cannot make it exactly the same as the model graph.
  The data I used to create the dynamic bar chart is here:</p>
  
  <pre><code>tidyadhd &lt;- structure(list(voltage = c(9.5, 10, 9.2, 6, 9, 11, 9, 9.2, 8, 
  9, 11, 9, 8.2, 8, 9, 9, 6, NA, 9.5, 9, 7.1, 9.3, 9, 9.5, 9, 9.2, 
  9.3, 9, 8.5, 9, 9.2, 9.3, 8.2, 9, 9.3, NA, 9.5, 9, 9.2, 9.3, 
  9, 9.5, 9, 9.2, 9.3, 9, 9.5, 9, 9, 9, 9.3, 8, 7, 8, 5.1, 4.3, 
  4.5, 5.3, 4.5, 5.1, 4.3, 4.5, 5.3, 4.5, 5.1, 4.3, 4.3, 4.3, 5.3, 
  6.4, 5, 8), state = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
  1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 
  2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
  1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
  2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L
  ), .Label = c("Rest", "Cue"), class = "factor"), treatment = c("placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "placebo", 
  "placebo", "placebo", "placebo", "placebo", "placebo", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", "ritalin", 
  "ritalin", "ritalin", "ritalin", "ritalin", "ritalin"), patient = c(1L, 
  2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 
  16L, 17L, 18L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
  12L, 13L, 14L, 15L, 16L, 17L, 18L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
  8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 1L, 2L, 
  3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 
  17L, 18L)), .Names = c("voltage", "state", "treatment", "patient"
  ), row.names = c(NA, -72L), class = "data.frame")
  </code></pre>
  
  <p>and an image of a part of the output table is shown in this image here:
  <img src="https://i.stack.imgur.com/NkJqt.png" alt="two-way ANOVA table"></p>
  
  <p>Can someone teach me how to create a dynamic bar plot with an exact same format as this model graph please? Thank you.<img src="https://i.stack.imgur.com/fsvAW.png" alt="">  </p>