Lets assume I have a syntax like this, I will repurpose the example in
Missing examples on how to use col_date(format = "...") · Issue #1203 · tidyverse/readr · GitHub :
example <- tibble::tribble(
~animal, ~date,
"cow", "2021/05/05 9:03:45",
"chicken", "2021/05/06 17:35:24",
"horse", "2021/05/07 23:49:23",
"dog", "2021/05/08 05:05:59"
)
write_csv(example, "date_example.csv")
Now I want to import these dates as dates, and I would expect something like
library(readr)
date_example <- read_csv("date_example.csv",
col_types = cols(date = col_date(format = "%Y/%m/%d"))
)
to work, however, the timestamps at the end seem to get in the way. Trying it like this in my longer example results in a bunch of NAs. So how do I get rid of the "9:03:45" at the end in the first row for example?