我想在 R 中创建一个类。我有很多表,我想通过一个函数来绘制它们。我使用的代码是:
temp <- data.frame(gsbi1_30,gsbi1_29,ob_30,ob_29)
其中 gsbi1_30,gsbi1_29,ob_30,ob_29 是表。
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) }
我想出了这个错误:
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
样本数据:
-0.6 -1.2 -1.0 -0.8 -0.4 -0.2
所有其他样本都具有相同的结构。