简体   繁体   中英

How to get rollingMean function in R package Openair to work?

I'm trying to get the 8 hour rolling mean for o3 using the rollingMean function using this code:

mydata <- rollingMean(mydata, pollutant = "o3", hours = 8)
breaks <- c(0, 34, 66, 100, 121, 141, 160, 188, 214, 240, 500)
labels <- c("Low.1", "Low.2", "Low.3", "Moderate.4", "Moderate.5", "Moderate.6",
"High.7", "High.8", "High.9", "Very High.10")
calendarPlot(mydata, pollutant = "rolling8o3",breaks = breaks, labels = labels, cols = "jet", statistic = "max"

But I keep getting this error message:

Error in strsplit(interval, split = " ") : non-character argument
In addition: Warning message:
In diff(as.numeric(unique(dates[order(dates)]))) :
  NAs introduced by coercion

Any help with this would be greatly appreciated I'm very new to R. Thanks

If you attach mydata from the package using data(mydata) , it should work.

library(openair)
data(mydata)
mydata <- rollingMean(mydata, pollutant = "o3", hours = 8)
breaks <- c(0, 34, 66, 100, 121, 141, 160, 188, 214, 240, 500)
labels <- c("Low.1", "Low.2", "Low.3", "Moderate.4", "Moderate.5", "Moderate.6",
            "High.7", "High.8", "High.9", "Very High.10")
calendarPlot(mydata, pollutant = "rolling8o3",breaks = breaks, labels = labels, cols = "jet", statistic = "max")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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