title: bystats Command for Summarizing one Variable by Another
body: <p>I wanted to get some input on my solution for this question. I was requested to summarize the birth weight of patients by their race using the bystats command.</p>
  <pre><code>bystats(SB_xlsx$bwt, SB_xlsx$race, fun=function(x) c(Mean=mean(x), Median=median(x), Mode=mode(x), SD=sd(x), quantile(x)))
  ## 
  ##  c(1, 40, 1, 121, 40, 121, 1, 1) of SB_xlsx$bwt by SB_xlsx$race 
  ## 
  ##                 N     Missing Mean               Median Mode     
  ## black           &quot;369&quot; &quot;0&quot;     &quot;1071.72628726287&quot; &quot;1100&quot; &quot;numeric&quot;
  ## native american &quot;16&quot;  &quot;0&quot;     &quot;986.5625&quot;         &quot;1035&quot; &quot;numeric&quot;
  ## oriental        &quot;4&quot;   &quot;0&quot;     &quot;1150&quot;             &quot;1140&quot; &quot;numeric&quot;
  ## white           &quot;257&quot; &quot;0&quot;     &quot;1151.08171206226&quot; &quot;1200&quot; &quot;numeric&quot;
  ## NA              &quot;23&quot;  &quot;2&quot;     &quot;875.217391304348&quot; &quot;750&quot;  &quot;numeric&quot;
  ## ALL             &quot;669&quot; &quot;2&quot;     &quot;1093.88639760837&quot; &quot;1120&quot; &quot;numeric&quot;
  ##                 SD                 0%    25%    50%    75%      100%  
  ## black           &quot;272.51016811411&quot;  &quot;400&quot; &quot;850&quot;  &quot;1100&quot; &quot;1300&quot;   &quot;1500&quot;
  ## native american &quot;261.984215491443&quot; &quot;400&quot; &quot;920&quot;  &quot;1035&quot; &quot;1127.5&quot; &quot;1450&quot;
  ## oriental        &quot;164.519502390041&quot; &quot;960&quot; &quot;1080&quot; &quot;1140&quot; &quot;1210&quot;   &quot;1360&quot;
  ## white           &quot;231.682983871944&quot; &quot;510&quot; &quot;975&quot;  &quot;1200&quot; &quot;1330&quot;   &quot;1580&quot;
  ## NA              &quot;336.487465188897&quot; &quot;540&quot; &quot;585&quot;  &quot;750&quot;  &quot;1070&quot;   &quot;1490&quot;
  ## ALL             &quot;265.224747555532&quot; &quot;400&quot; &quot;900&quot;  &quot;1120&quot; &quot;1310&quot;   &quot;1580&quot;
  </code></pre>
  <p>The summary requested was vague, but this was the information obtained in lecture, so I also went with the same information. I'm just wanting to make sure I did not miss any command, so that my summary I have typed after getting this info comparing means and quantiles is accurate.</p>