timeVeriation function, the plot only shows 23 hours a day

Hi! I am using the timeVeriation function in the openair package to analyse the data, but the x-axis ‘hours’ in the top and bottom left plots are 0 to 23, which means that the hour 23 to 24 (0) is missing (as Monday's 23:00 and Tuesday's 0:00 on the same line). Is there anything I can do to see the full 24 hours of the day?
Thank you so much!

Hi, and welcome to the forum. We probably need to see your actual code and some sample data. You may want to have a look at FAQ: How to do a minimal reproducible example ( reprex ) for beginners

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need.

BTW you mean timeVariation do you not?

Ah, wait a minute. I just tried this on a package dataset and it gives the same results as you are getting. The plots appear to start at time zero so from 0:23 gives you 24 hourly data points.

Yeah, I can get 24 hours of data points starting from 0 to 23, but if you look at the top image, Monday's 23:00 and Tuesday's 0:00 are overlapping on a line, so there is a sudden change at that point and I can't see the change for the hour in between. I guess it could be that the packet is designed that way, is there any way I can see the full change? Many thanks!

By the way, here's my code.

roomtemp<- fread("HFD_RoomTemp_2021_2022.csv", 
             header = F, sep = ",", skip=1,
             na.strings = "NA",
             col.names = c("date", "room.temp")
             )
dev.new()
timeVariation(roomtemp,pollutant="room.temp", statistic = "median", col="firebrick")

And the data of date is from 2021-06-15 13:42:01 to 2022-06-20 00:10:00, one data every 30 seconds.
Screenshot 2022-07-25 at 07.26.54

There is no change in regard to the time denoted in your plots.
The plots denoted by hour, are divided into 4 groups of 6 hours.

The "overlap" is a product of the grouping of those 6 hour intervals denoted by the following expression;

image

However, we read a clock as the following instead;

image

Or more accurately;

image

In other words, the overlap can be viewed in the following table

the [hour] and [pair] variables cohere to the 4 groups of 6 hours.

     n hour pair group
 1:  0    0    1     1
 2:  1    1    2     1
 3:  2    2    3     1
 4:  3    3    4     1
 5:  4    4    5     1
 6:  5    5    6     1
 7:  6    6    7     2
 8:  7    7    8     2
 9:  8    8    9     2
10:  9    9   10     2
11: 10   10   11     2
12: 11   11   12     2
13: 12   12   13     3
14: 13   13   14     3
15: 14   14   15     3
16: 15   15   16     3
17: 16   16   17     3
18: 17   17   18     3
19: 18   18   19     4
20: 19   19   20     4
21: 20   20   21     4
22: 21   21   22     4
23: 22   22   23     4
24: 23   23    0     4
25: 24    0    1     1
     n hour pair group

oh I got it! Thank you so much!

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.