Error with the date variable not found

Hello Family. I am getting the error from an air quality data analysis i am trying . Kindly assist me. timeVariation(node, pollutant = "PM.2.5", statistic = "median",col = "firebrick") Can't find the variable(s) date Error in checkPrep(mydata, vars, type, remove.calm = FALSE) :
below is the format of the date to be used
$ Date2 : POSIXct, format: "2019-12-01 00:03:57" "2019-12-01 00:04:57" ...

node

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

1 Like
ID Node Date Time PM.2.5 PM.10
1 FD 11 191201 445 5.48 19.77
2 FD 11 191201 545 5.99 7.33
3 FD 11 191201 645 4.6 4.66
4 FD 11 191201 745 4.93 5.48
5 FD 11 191201 845 5.21 18.55
6 FD 11 191201 945 4.97 16.31
7 FD 11 191201 1045 4.65 4.84
8 FD 11 191201 1145 4.5 13.6
9 FD 11 191201 1245 5.34 7.74
10 FD 11 191201 1345 5.81 5.87
11 FD 11 191201 1445 5.73 5.85
12 FD 11 191201 1545 5.38 5.95
13 FD 11 191201 1645 6.67 7.5
14 FD 11 191201 1745 4.56 4.75
15 FD 11 191201 1845 4.3 7.7
16 FD 11 191201 1945 6.73 7.23
17 FD 11 191201 2045 12.04 16.82
18 FD 11 191201 2145 9.37 9.65
19 FD 11 191201 2245 5.44 5.55
20 FD 11 191201 2345 4.63 5.05
21 FD 11 191201 2445 4.67 4.78
22 FD 11 191201 2545 5.14 5.3
23 FD 11 191201 2645 3.79 4.32
24 FD 11 191201 2745 5.34 5.52
25 FD 11 191201 2845 11.17 12.59
26 FD 11 191201 2945 10.34 10.95
27 FD 11 191201 3045 6.02 9.55
28 FD 11 191201 3145 6.17 8.35
29 FD 11 191201 3245 7.38 7.85
30 FD 11 191201 3345 7.56 8.15
31 FD 11 191201 3445 8.31 9.75
32 FD 11 191201 3545 7.75 10.08

Find the minimal dataset, the package used in this case is Open air. The issue is about the raw format of the date and time from the initial data set..

Hi. You should have another go at the reproducible example. Have a look at the article.

col = "firebrick"

What's that supposed to be? It isn't in your dataset.

Can't find the variable(s) date

Not sure if this is from the same code, but your date column is called 'Date'.

Hello, form the data set i tried to combine (Date - Time) to get it in a Date to time format. using iq$Date2 <- as.POSIXlt(iq$Date1,format="%d/%m/%Y %H:%M:%S",tz=Sys.timezone()).
image


i still got the same error. i hope this would help to understand my issue better


find the format of data in the IQ data set

I think you are giving too much credit to the openair timeVariation function, its not sufficient for the date variable to be a date class, it must have the exact name 'date'
here is a demo

timeVariation(mydata, pollutant = "nox")
timeVariation(mydata %>% rename(date2=date), pollutant = "nox")
1 Like

This topic was automatically closed 21 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.