-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Description
Specifying custom NA values in a non-character column does not work: the NA values are treated as character cells instead of being set to NA.
This is related to other opened issues about a better column type interface (#51 and in particular #64), but it is a sufficiently distinct use case to warrant a separate issue IMO.
I have created a public spreadsheet (1D98U_4wx2pm2-0hUuOOJNM0NKDv-WouP2IRuBFnWrRg
) containing:
A | B | C | D |
---|---|---|---|
1 | 1 | 1 | 1 |
Missing | NA | 2 | |
3 | 3 | 3 | 3 |
Reprex:
googlesheets4::read_sheet("1D98U_4wx2pm2-0hUuOOJNM0NKDv-WouP2IRuBFnWrRg",
na = c("", "NA", "Missing"))
#> Reading from 'Reprex for guessed ctype in presence of NAs'
#>
#> # A tibble: 3 x 4
#> A B C D
#> <list> <list> <dbl> <dbl>
#> 1 <dbl [1]> <dbl [1]> 1 1
#> 2 <chr [1]> <chr [1]> NA 2
#> 3 <dbl [1]> <dbl [1]> 3 3
Created on 2019-12-09 by the reprex package (v0.3.0)
Of course, I was expecting the behaviour from readr
.
csv_txt <- "A B C D
1 1 1 1
Missing NA 2
3 3 3 3"
readr::read_delim(csv_txt, na = c("", "Missing", "NA"), delim = "\t")
#> # A tibble: 3 x 4
#> A B C D
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 1 1
#> 2 NA NA NA 2
#> 3 3 3 3 3
Created on 2019-12-09 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
No labels