I've imported a dataset with dates in the format 'month year' (e.g. July 2020
), which have automatically been parsed as characters. I'm trying to convert them to dates, using lubridate::parse_date_time()
. When I do this, lubridate returns a list of dates (e.g. "2020-07-01 UTC", "2020-07-01 UTC", "2020-07-01 UTC", "2020-07-01 UTC", "2020-07-01 UTC", "2020-06-01 UTC", "2020-06-01 UTC", "2020-06-01 UTC", "2020-06-01 UTC", "2020-06-01 UTC"
etc).
This is what I want, but now I'm stuck: I'm not sure how to get these back into my original dataframe, replacing the previous column of characters with this new date representation. Is there a really obvious way to do this?
dput(data)
or if your data is very largedput(data[1:20,])
. You should replacedata
with the name of your actual data.frame. You can edit your question and paste the output. Please surround the output with three backticks (```) for better formatting. See How to make a reproducible example for more info. – Ian Campbell