'Non convenient date format. Time zone must be defined as "UTC" error message

I'm a beginner in programming with R, I have a csv file with 4 columns :

DateR        P   E    Q
2017-09-01 0.20 4.6 0.263
2017-09-02 0.15 3.0 0.157
...
2021-09-01 0.57 8.6 0.574

I want to run a code with a airGRteaching packaging and I have this error message that shows up : Non convenient date format. Time zone must be defined as "UTC"

I had already convert the class of the dataR to POSIXct.

Please any suggestions ?

r


Solution 1:[1]

Try converting the class to POSIXct as follows:

df$DateR = as.POSIXct(df$DateR, 'UTC')

Substitute df with the name of your dataframe.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Caspar V.