title: Plot function by using predefined variables in R
body: <p>I wanted to create a class in R. I have number of tables and I wanted to plot them by a function. The code I have used is:</p>
  
  <pre><code>temp &lt;- data.frame(gsbi1_30,gsbi1_29,ob_30,ob_29)
  </code></pre>
  
  <p>where gsbi1_30,gsbi1_29,ob_30,ob_29 are tables.</p>
  
  <pre><code>par(mfrow=c(2,2))
  for (i in temp){ plot(i$ambtemp,type="o", pch=22, lty=2, col="brown",xlab = "Hour  2007/09/29" , ylab= "Ambient Tempreture" )
                   title(main="Hourly Mean, node 25", col.main="brown", font.main=1) }
  </code></pre>
  
  <p>And I came up with this error:</p>
  
  <pre><code>Error in plot(i$ambtemp, type = "o", pch = 22, lty = 2, col = "brown",  : 
    error in evaluating the argument 'x' in selecting a method for function 'plot': Error in i$ambtemp : $ operator is invalid for atomic vectors
  </code></pre>
  
  <p>Sample Data:</p>
  
  <pre><code>-0.6 -1.2 -1.0 -0.8 -0.4 -0.2
  </code></pre>
  
  <p>All the other samples are in the same structure.</p>