Non tidyverse/lubridate method for ymd()?

A follow-up, but separate topic from here: Is there a dplyr or tidytable method for na.omit()?

It seems that there is a rather low limit to how many rows the function ymd() from the lubridate() package can take, which is similar in my experience for other dplyr functions. The trouble is that there is no tidytable equivalent for this: Function reference • tidytable

How can I make R recognise the date column in the ymd format?

Can you post a reproducible example of your code and data? I've not experienced an issue with running too many rows in ymd() and I've used it within tidytable's mutate.()

Base as.Date will also convert dates: as.Date function - RDocumentation

1 Like

By "rather low limit to how many rows" do you mean that related to a performance bottleneck for your data? Roughly how many rows do you have? In one recent test, I found it converted 0.5-5M strings per second, depending on format, which could be considered fast or slow depending on the context.

What date format(s) are you looking to convert to Date format? ymd is designed to be very flexible and parses many possible format variations like "21 Jan 20" and "2021.1.20" and "21 January-20," so if you know the format(s) ahead of time, another option may be faster.

1 Like
identical(ymd("20121231"),
          as.Date("20121231",format="%Y%m%d"))
[1] TRUE
1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.