0

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

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43

1 Answers1

0

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")
user63230
  • 4,095
  • 21
  • 43