Open mrgiorgio opened 7 months ago
There were some issues with the importAURN
function, this might have caused the error.
library(openair)
mary <- importAURN(site = "my1", year = 2000)
timeVariation(mary, pollutant = 'no2')
Created on 2024-08-07 with reprex v2.1.1
It seems to be working (note, I have changed the type
to default instead of month. as it produces a more readable plot).
Bug description
I am trying to obtain the following graph using the timeVariation plot. I must say that I had been generating these graphs since a long time ago.
Anyway, when I ran my code a few days ago I received this error from R
Error in mutate(): ℹ In argument: wkday = wday(date, label = TRUE, abbr = FALSE). Caused by error in factor(): ! invalid 'labels'; length 6 should be 1 or 7
.What I could verify by making some tests in the source code is that the label argument of the function is not working properly, so what worked for me was changing this part of the code
mydata <- mutate(mydata, wkday = wday(date, label = TRUE, abbr = FALSE), wkday = ordered(wkday, levels = day.ord), hour = hour(date), mnth = month(date))
for this one
mydata <- mutate(mydata, wkday = day.ord[wday(date)], wkday = ordered(wkday, levels = day.ord), hour = hour(date), mnth = month(date))
Now, despite the fact that this change helped solving the error, I could not implemented it, because when trying to define the function with this change and running it in my main code, some reiterative non defined functions and dependencies were asked and I gave up trying.
Steps to reproduce
Using the following code you can check the error
library(openair) mary <- importAURN(site = "my1", year = 2000)
timeVariation(mary, pollutant = 'no2', type = 'month')
Openair version
‘2.18.2’