I'm working with a dataset in R, and I'm using mutate() to clean up date values by removing the time zone abbreviation EET or EEST. However, when I try to convert the cleaned date from its original character class to a POSIXct format, I get the following warning:
There was 1 warning in mutate()
.
ℹ In argument: date = str_remove(date, "EET |EEST ")
.
Caused by warning in as.POSIXlt.POSIXct()
:
! unknown timezone 'EEST'
Here's the code I am using:
df <- df |>
mutate(
date = str_remove(date, "EET |EEST "), # Removing the timezone
date = parse_date_time(date, orders = "a b d H:M:S Y") # Parsing the date
)
Problem:
I am removing the EET and EEST time zones from the date column using str_remove()
.
After removing the time zone, I try to convert the date column to a POSIXct
format.
The warning suggests that EEST is still causing an issue.
What I've Tried:
I've tried adjusting the str_remove()
to make sure the spaces are correctly handled ("EET |EEST ")
. I validated that EEST is correctly removed with any(grepl("EEST", sales_beef$date))
, which returns FALSE
.
I also tried using as.POSIXct()
with a specific tz = "UTC", but the warning still appears.
Expected Behavior:
I expect the date column to be successfully parsed without any warnings related to time zones.
Question: What is causing this warning about the unknown timezone EEST, and how can I avoid this issue? Should I remove the time zone differently or handle the conversion in a different way?
Date format: "Tue Aug 22 14:50:15 EEST 2017" or "Wed Aug 23 14:50:15 EET 2018". Note that the timezones are either EET or EEST.