title: dplyr pipe multiple datasets to summarize()
body: <p>I am making a table using dplyr.  I want to perform the same "summarize" command on multiple datasets.  I know in ggplot2, you can just change out the dataset and rerun the plot, which is cool.  </p>
  
  <p>here's what I want to avoid:</p>
  
  <pre><code>table_1 &lt;- 
  group_by(df_1, boro) %&gt;%
    summarize(n_units = n(),
              mean_rent = mean(rent_numeric, na.rm = TRUE),
              sd_rend = sd(rent_numeric,na.rm = TRUE),
              median_rent = median(rent_numeric, na.rm = TRUE),
              mean_bedrooms = mean(bedrooms_numeric, na.rm = TRUE),
              sd_bedrooms = sd(bedrooms_numeric, na.rm = TRUE),
              mean_sqft = mean(sqft, na.rm = TRUE),
              sd_sqft = sd(sqft, na.rm = TRUE),
              n_broker = sum(ob=="broker"),
              pr_broker = n_broker/n_units)
  
  table_2 &lt;- 
  group_by(df_2, boro) %&gt;%
    summarize(n_units = n(),
              mean_rent = mean(rent_numeric, na.rm = TRUE),
              sd_rend = sd(rent_numeric,na.rm = TRUE),
              median_rent = median(rent_numeric, na.rm = TRUE),
              mean_bedrooms = mean(bedrooms_numeric, na.rm = TRUE),
              sd_bedrooms = sd(bedrooms_numeric, na.rm = TRUE),
              mean_sqft = mean(sqft, na.rm = TRUE),
              sd_sqft = sd(sqft, na.rm = TRUE),
              n_broker = sum(ob=="broker"),
              pr_broker = n_broker/n_units)
  </code></pre>
  
  <p>Basically, is there a way to set up the summarize command as a function or something maybe so I can just pour in df_1 and df_2?</p>