title: R Side by Side Histograms
body: <p>So I have a problem where I had to generate two random samples, and I am trying to display side-by-side histograms using par(), but I am having trouble making it work. Code is below:</p>
  
  <pre><code>set.seed(123) 
  x &lt;- rnorm(1000, 0, 2)
  
  set.seed(123)
  y &lt;- rnorm(1000, 0, 1)
  
  cbind(x,y)
  
  sd1 &lt;- sd(x)
  sd2 &lt;- sd(y)
  
  hist(x) 
  hist(y)
  
  par(mfrow = c(2,1)
  
  xlim=c(-6,6)
  </code></pre>
  
  <ul>
  <li>Also, how do I make x and y different colors on the histogram? Thanks!</li>
  </ul>