In my dataset, time is indicated by "Wed Feb 12 22:29:36 +0000 2020", which isn't recognised by ggplot. I want to make a graph with date on the x-as. How can I convert the time in my dataset in a normal data-format? I got a million observations, so changing them one by one is not an option! I tried working with the libridate packate, but it doesn't seem able to help me.
This is a bit unusual timestamp, but still readily parsable.
Here I used base R only, but should not be a problem with
lubridate. You have to use
as_datetime, and it will return UTC time by default. What problem did you face?
# as date object as.Date(x = "Wed Feb 12 22:29:36 +0000 2020", format = "%a %B %d %H:%M:%S %z %Y") #>  "2020-02-12" # as date-time object as.POSIXct(x = "Wed Feb 12 22:29:36 +0000 2020", format = "%a %B %d %H:%M:%S %z %Y") #>  "2020-02-13 03:59:36 IST"
Created on 2020-02-26 by the reprex package (v0.3.0)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.