Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeVariation function not working #382

Open
mrgiorgio opened this issue Apr 8, 2024 · 1 comment
Open

timeVariation function not working #382

mrgiorgio opened this issue Apr 8, 2024 · 1 comment
Labels
bug Bugs in the current release of openair

Comments

@mrgiorgio
Copy link

mrgiorgio commented Apr 8, 2024

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.
image

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’

@mrgiorgio mrgiorgio added the bug Bugs in the current release of openair label Apr 8, 2024
@mooibroekd
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in the current release of openair
Projects
None yet
Development

No branches or pull requests

2 participants