You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I tracked down a bug where the 'year' column in my data was a bit strange. It turns out that cutData overwrites the data when a particular order is used to create columns.
Steps to reproduce
packageVersion("openair")
#> [1] '2.18.2'# create some date data for illustrationtest<-data.frame(date= seq.Date(lubridate::date("2022-01-01"),
lubridate::date("2022-12-31"),
by=1))
# cut the data into yearstest<-openair::cutData(test, type="year")
# check if we have any dates that are associated with 2023test|>dplyr::filter(year==2023)
#> [1] date year#> <0 rows> (or 0-length row.names)# now cut the data to yearseasontest<-openair::cutData(test, type="yearseason")
# perform the test again:test|>dplyr::filter(year==2023)
#> date year season month yearseason#> 1 2022-12-01 2023 winter (DJF) 12 winter (DJF) - 2023#> 2 2022-12-02 2023 winter (DJF) 12 winter (DJF) - 2023#> 3 2022-12-03 2023 winter (DJF) 12 winter (DJF) - 2023#> 4 2022-12-04 2023 winter (DJF) 12 winter (DJF) - 2023#> 5 2022-12-05 2023 winter (DJF) 12 winter (DJF) - 2023#> 6 2022-12-06 2023 winter (DJF) 12 winter (DJF) - 2023#> 7 2022-12-07 2023 winter (DJF) 12 winter (DJF) - 2023#> 8 2022-12-08 2023 winter (DJF) 12 winter (DJF) - 2023#> 9 2022-12-09 2023 winter (DJF) 12 winter (DJF) - 2023#> 10 2022-12-10 2023 winter (DJF) 12 winter (DJF) - 2023#> 11 2022-12-11 2023 winter (DJF) 12 winter (DJF) - 2023#> 12 2022-12-12 2023 winter (DJF) 12 winter (DJF) - 2023#> 13 2022-12-13 2023 winter (DJF) 12 winter (DJF) - 2023#> 14 2022-12-14 2023 winter (DJF) 12 winter (DJF) - 2023#> 15 2022-12-15 2023 winter (DJF) 12 winter (DJF) - 2023#> 16 2022-12-16 2023 winter (DJF) 12 winter (DJF) - 2023#> 17 2022-12-17 2023 winter (DJF) 12 winter (DJF) - 2023#> 18 2022-12-18 2023 winter (DJF) 12 winter (DJF) - 2023#> 19 2022-12-19 2023 winter (DJF) 12 winter (DJF) - 2023#> 20 2022-12-20 2023 winter (DJF) 12 winter (DJF) - 2023#> 21 2022-12-21 2023 winter (DJF) 12 winter (DJF) - 2023#> 22 2022-12-22 2023 winter (DJF) 12 winter (DJF) - 2023#> 23 2022-12-23 2023 winter (DJF) 12 winter (DJF) - 2023#> 24 2022-12-24 2023 winter (DJF) 12 winter (DJF) - 2023#> 25 2022-12-25 2023 winter (DJF) 12 winter (DJF) - 2023#> 26 2022-12-26 2023 winter (DJF) 12 winter (DJF) - 2023#> 27 2022-12-27 2023 winter (DJF) 12 winter (DJF) - 2023#> 28 2022-12-28 2023 winter (DJF) 12 winter (DJF) - 2023#> 29 2022-12-29 2023 winter (DJF) 12 winter (DJF) - 2023#> 30 2022-12-30 2023 winter (DJF) 12 winter (DJF) - 2023#> 31 2022-12-31 2023 winter (DJF) 12 winter (DJF) - 2023# reason why this is happening is because the winter is defined from december # yyyy to march yyyy+1.# I would suspect cutData to only return the yearseason, not the year and season# columns (or overwrite them if they exists.)
Bug description
Today I tracked down a bug where the 'year' column in my data was a bit strange. It turns out that cutData overwrites the data when a particular order is used to create columns.
Steps to reproduce
Created on 2024-12-22 with reprex v2.1.1
Openair version
No response
The text was updated successfully, but these errors were encountered: