tryFormats for readr

Does read_csv support something like "tryFormats" from base::as.Date()? I see an "Automatic parsers" option from parse_date(), does this have similar functionality?

I don't think parse_datetime has already a tryFormats feature equivalent. For that, you could use col_types argument in read_csv to set this colum as character and do the date parsing on a second step after reading (using as.Date, lubridate::ymd or anytime::anydate).
Basically, this would mean do not use readr parsing and use your own. When you want custom thing, this is often the way to go I think.

Hope it helps

Thank you! This might be a useful addition. How does one make a recommendation for future features?

1 Like

You make a feature request on the GitHub repo

2 Likes

Posted:
https://github.com/tidyverse/readr/issues/1074

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.