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:
temp <- data.frame(gsbi1_30,gsbi1_29,ob_30,ob_29)
where gsbi1_30,gsbi1_29,ob_30,ob_29 are tables.
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) }
And I came up with this error:
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
Sample Data:
-0.6 -1.2 -1.0 -0.8 -0.4 -0.2
All the other samples are in the same structure.