reconhub / linelist

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

stamp() and guess_formats() crash with NA's in x #70

Closed DaniMori closed 5 years ago

DaniMori commented 5 years ago

When argument x in either stamp() or guess_formats() has at least one NA value, these functions crash.

library(lubridate, quietly = TRUE)
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date

## OK:
stamp(c("2019-04-26", "2019-04-25"))
#> Multiple formats matched: "%Y-%Om-%d"(2), "%Y-%m-%d"(2)
#> Using: "%Y-%Om-%d"
#> function (x, locale = "Spanish_Spain.1252") 
#> {
#>     {
#>         old_lc_time <- Sys.getlocale("LC_TIME")
#>         if (old_lc_time != locale) {
#>             on.exit(Sys.setlocale("LC_TIME", old_lc_time))
#>             Sys.setlocale("LC_TIME", locale)
#>         }
#>     }
#>     format(x, format = "%Y-%Om-%d")
#> }
#> <environment: 0x0000000019c7a8a0>

## Not run:
stamp(c("2019-04-26", NA_character_))
#> Error in if (any(matched)) {: valor ausente donde TRUE/FALSE es necesario

Created on 2019-04-26 by the reprex package (v0.2.1)

zkamvar commented 5 years ago

Hi @DaniMori, I think you might have the wrong repository. This looks like a lubridate issue (https://github.com/tidyverse/lubridate/issues/new).

DaniMori commented 5 years ago

Yes, I just noticed that. So sorry, I'll close it straight away.