Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type_convert() does not parse IEEE 754 double values (NaN, Inf, -Inf) #1526

Open
khusmann opened this issue Dec 7, 2023 · 0 comments
Open

Comments

@khusmann
Copy link

khusmann commented Dec 7, 2023

Loading a csv with NaN, Inf, -Inf values with col_double() works as expected (#1225):

read_csv("a\nNaN\nInf\n-INF", col_types = cols(a=col_double()))
## A tibble: 3 × 1                                                                                                                                                         
#      a
#  <dbl>
#1   NaN
#2   Inf
#3  -Inf

But a similar type_convert() throws errors, and loads all the special values as NA:

type_convert(tibble(a=c("NaN", "Inf", "-INF")), col_types = cols(a=col_double()))
## A tibble: 3 × 1
#      a
#  <dbl>
#1    NA
#2    NA
#3    NA
#Warning messages:
#1: [0, 1]: expected a double, but got 'NaN' 
#2: [1, 1]: expected a double, but got 'Inf' 
#3: [2, 1]: expected a double, but got '-INF'

Is this the intended behavior? Or an artifact of v1 vs v2 (#1277)? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant