Hello, I am trying to use trendLevel from the openair package which I have done successfully in the past. The overall goal is to compare the background concentration of CO at 4 reference stations over time (2019-2022). I have used this exact code on a similar dataset (one of the stations from 2018-2021) and that worked, so I am confused as to why I am getting the following error:
Error: trendLevel could not complete supplied statistic operation 'mean'. [R error below] CO
-
stop(paste0("\ttrendLevel could not complete supplied statistic operation '", stat.name, "'.\n\t[R error below]", "\n\t", temp[1]), call. = FALSE)
-
trendLevel(AMS1, pollutant = "CO")
I used the following code:
library(tidyverse)
library(dplyr)
library(lubridate)
library(plotly)
library(openair)
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
AMS1 <- read.csv(file.choose())
AMS1$CO <- AMS1$CO *1000
AthVal <- read.csv(file.choose())
AthVal$CO <- AthVal$CO * 1000
FtChip <- read.csv(file.choose())
FtChip$CO <- FtChip$CO*1000
StonyMtn <- read.csv(file.choose())
StonyMtn$CO <- StonyMtn$CO*1000
AMS1$Date_Time <- ymd_hm(AMS1$Date_Time)
trendLevel(AMS1, pollutant = "CO")
trendLevel (AthVal, pollutant = "CO.Cleaned", x = "month", y = "hour", type = "year", plot = TRUE )
trendLevel(FtChip, pollutant = "CO.Cleaned", x = "month", y = "hour", type = "year", plot = TRUE)
trendLevel(StonyMtn, pollutant = "CO.Cleaned", x = "month", y = "hour", type = "year", plot = TRUE)
I have also tried using an internal function that calculates the mean while removing NAs but that doesn't seem to help as I get the same error. I have tried all the statistics that trendLevel is able to use, and I get the same thing.
My data can be found here: [GitHub - 9kgli/OpenAirHelp](https://Regional Background CO Data)