Closed PaulMelloy closed 1 year ago
This occured after updating R to version 4.3
write.csv
simplifies date times on midnight to only the date omiting HH:MM:SS
eg 2023-06-06 00:00:00
becomes 2023-06-06
When read back in and as.POSIXct is used it can't parse correctly and causes NA
s
A workaround, for now, is saving with data.table::fwrite()
and reading back in with data.table::fread()
.
261d624f5ae78a42f9330fd6a4b9f0341cfad8d0
I may have to investigate this further to see if there is a documented method for keeping 00:00:00
Updating format_weather()
with solution in https://stackoverflow.com/questions/37089536/how-can-i-keep-midnight-0000h-using-strptime-in-r
This is a feature of R POSIXt and is documented in the strptime
help
format | A character string. The default for the format methods is "%Y-%m-%d %H:%M:%S" if any element has a time component which is not midnight, and "%Y-%m-%d" otherwise. If options("digits.secs") is set, up to the specified number of digits will be printed for seconds.
format_weather()
is failing citing that after writing the formated table to csv withwrite.csv()
then reading it back inread.csv()
the data now has duplicated times andNA
times .