title: How to create a table with means and standard deviations by group
body: <p>I have success creating a table of means and standard deviations, but now I need to separate the variables results by two groups, in this case by gender. </p>
  
  <pre><code>cols&lt;-c('edad','experiencia','indigena','mestizo','blanco','años_educ')
  
  stargazer(base[which(base$año=="2009"),][, cols], type = "text", 
     summary.stat = c("min", "p25", "median", "p75", "max", "mean", "sd"))
  </code></pre>
  
  <p>This code has allowed me to create this well formatted table, it also contain other stats, but now I want to dived the results by groups with more or less the same code. How can I achieve this?</p>
  
  <pre><code>============================================================
  Statistic   Min Pctl(25) Median Pctl(75) Max  Mean  St. Dev.
  ------------------------------------------------------------ 
  edad         0     13      25      47    99  30.701  21.997 
  experiencia  0     2       8       20    80  12.924  14.222 
  indigena     0     0       0       0      1  0.080   0.271  
  mestizo      0     1       1       1      1  0.814   0.389  
  blanco       0     0       0       0      1  0.053   0.224  
  años_educ    0     5       7       12    21  8.423   4.563  
  ------------------------------------------------------------
  </code></pre>