简体   繁体   English

R在调用Plot函数列表中的语法错误

[英]Syntax error in R in calling the list for Plot function

I have a list that I wanted to put the content within the plot code but I have faced with this error: 我有一个列表,希望将内容放入打印代码中,但遇到了此错误:

Error: object 'pl29' not found

Moreover, corresponding code is : 而且,对应的代码是:

Pl29 <- list(HMn25_29,HMn28_29)
par(mfrow=c(2,2))
for ( i in pl29) {
  plot(i, type = "o", pch = 22, lty = 2, col = "Black", xlab = "Hour  2007/09/29" , ylab = "Ambient Tempreture")
}

And sample data is: 样本数据为:

(HMn25_29)
                    h   avg_val
1 2007-09-29 00:00:00 -1.876667
2 2007-09-29 01:00:00 -1.693667
3 2007-09-29 02:00:00 -1.766667
4 2007-09-29 03:00:00 -1.928667
5 2007-09-29 04:00:00 -2.132581
6 2007-09-29 05:00:00 -1.752258

      (HMn28_29)
                    h   avg_val
1 2007-09-29 00:00:00 -1.922500
2 2007-09-29 01:00:00 -1.667667
3 2007-09-29 02:00:00 -1.582000
4 2007-09-29 03:00:00 -1.571667
5 2007-09-29 04:00:00 -1.829000
6 2007-09-29 05:00:00 -1.615333

R is case sensitive, and you forgot to capitalize Pl29 the second time: R区分大小写,并且您第二次忘记大写Pl29

Pl29 <- list(HMn25_29,HMn28_29)  # capitalized: Pl29
par(mfrow=c(2,2))
for ( i in pl29)  # not capitalized: pl29

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM