readr icon indicating copy to clipboard operation
readr copied to clipboard

FR: Spin off `readr::type_convert()` and other type inferencing tools

Open chainsawriot opened this issue 2 years ago • 2 comments

I found that several R and BioC packages using readr are simply using readr::type_convert(), readr::parse_date() and column specification tools only for converting ambiguous dataframes with appropriate column types (e.g. readODS, timetk, sergeant, unglue, surveytoolbox). While this package's main functionalities are reading rectangular text files, it is quite unnatural for many packages depending on readr but not for reading text files.

I was wondering would you consider spinning off these type inferencing tools from readr? Thank you very much!

chainsawriot avatar Sep 14 '23 18:09 chainsawriot

I see where you're coming from, but readr (especially these legacy first edition bits of readr) is in a very quiescent phase at the moment. So, while I can imagine contemplating such a thing, in practice this is something I don't see getting any traction in the near to medium term. As the readr/vroom maintainer, there are other historical oddities that are more problematic and that I would prioritize over this.

jennybc avatar Sep 15 '23 14:09 jennybc

@jennybc I was wondering: if I do that myself, would the tidyverse team oppose it?

chainsawriot avatar Mar 12 '24 21:03 chainsawriot

As @hadley said in an email (and I agree), no objections if you want to make a separate package.

I'll just make one observation from maintaining readr and vroom, which is that it has been painful to have functions like those you mention (readr::type_convert(), readr::parse_date()) which are exported but, as of readr's second edition, are also not actually used by readr when parsing a file. Morally, obviously all of those things are trying to do the same thing, but the devil is in the details. Of course when those functions first appeared in readr, it was all hitting a common code path. The current situation is the result of switching readr's default backend to vroom.

Anyhow, I just wanted to record this gotcha somewhere, because I can totally imagine one of us needing to link to it in some future discussion of why a certain column converts one way when converted by itself, based on strings, and another way when converted as part of an entire file.

jennybc avatar Apr 19 '24 16:04 jennybc