trendLevel says that it cannot calculate any statistic when try to apply to dataset

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

  1. stop(paste0("\ttrendLevel could not complete supplied statistic operation '", stat.name, "'.\n\t[R error below]", "\n\t", temp[1]), call. = FALSE)

  2. 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)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.