title: Error in ncol(xj) : object 'xj' not found when using R matplot()
body: <p>Using <code>matplot</code>, I'm trying to plot the 2nd, 3rd and 4th columns of <code>airquality</code> data.frame after dividing these 3 columns by the first column of <code>airquality</code>.</p>
  
  <p>However I'm getting an error</p>
  
  <pre><code>Error in ncol(xj) : object 'xj' not found
  </code></pre>
  
  <p>Why are we getting this error? The code below will reproduce this problem.</p>
  
  <pre><code>attach(airquality)
  airquality[2:4] &lt;- apply(airquality[2:4], 2, function(x) x /airquality[1]) 
  matplot(x= airquality[,1], y= as.matrix(airquality[-1]))
  </code></pre>