reconhub / linelist

An R package to import, clean, and store case data
https://www.repidemicsconsortium.org/linelist
Other
25 stars 5 forks source link

Error thrown for an empty variable (only NAs) #108

Open aspina7 opened 4 years ago

aspina7 commented 4 years ago

Hello friends - was trying to run guess_dates over one of several date variables. Turns out one was empties, initial as a logical var, so switched it to a char and still got error thrown (see reprex). Thanks!

test_df <- dplyr::tibble(empty_var = as.character(c(NA, NA, NA, NA, NA)))
test_df
#> # A tibble: 5 x 1
#>   empty_var
#>   <chr>    
#> 1 <NA>     
#> 2 <NA>     
#> 3 <NA>     
#> 4 <NA>     
#> 5 <NA>
linelist::guess_dates(test_df$empty_var)
#> Error in if (prop_successful < (1 - error_tolerance)) {: missing value where TRUE/FALSE needed

Created on 2020-02-10 by the reprex package (v0.3.0)

zkamvar commented 4 years ago

I'll see what I can do.