title: Split dataset by grouping variable to create multiple bar plots at once
body: <p>I have a large dataset that looks like this:</p>
  <blockquote>
  <p>time, precip, grp</p>
  <p>2005-09-30 11:45:00,1.1,1</p>
  <p>2005-09-30 23:45:00,1.5,1</p>
  <p>2005-10-01 23:45:00,0.2,2</p>
  <p>2005-10-02 11:45:00,0.3,2</p>
  <p>2005-10-02 23:45:00,1.7,2</p>
  <p>2005-10-03 11:45:00,0.8,2</p>
  <p>2005-10-04 23:45:00,1.4,4</p>
  </blockquote>
  <p>I want to make separate data frames for each group (grp, there are a total of 65 groups in my full dataset) and produce a bar graph for each group.</p>
  <p>So far, I've made a list:</p>
  <pre><code>X &lt;- split(df, df$grp)
  
  str(X)
  
  Y &lt;- lapply(seq_along(X), function(x) as.data.frame(X[[x]])[, 1:2]) 
  
  lapply(seq_along(Y), function(x) {assign(grp[x], Y[[x]], envir=.GlobalEnv)})
  </code></pre>
  <p>which produces this:</p>
  <pre><code>&gt;Y
  
  &gt;[[1]]
  
                   time precip
  
  3 2005-10-01 11:45:00      0
  
  8 2005-10-03 23:45:00      0
  
  9 2005-10-04 11:45:00      0
  
  
  
  
  [[2]]
                      
                 time   precip
  
  1 2005-09-30 11:45:00 1.1
  
  2 2005-09-30 23:45:00 1.5
  
  
  ...
  </code></pre>
  <p>Is there a way to now plot each of these so that I have a different bar graph for each group, with time on the x-axis and precip on the y-axis? Ideally, the bar graphs would all be on the same page or part of the same output.</p>
  <p>Also, is there a way to export each of these as separate data frames?</p>
  <p>Thank you in advance!</p>