Here an example:
> time_length(interval(NA,ymd("2016-01-01")))
[1] NA
> time_length(interval(NA,ymd("2016-01-01")), unit = "year")
Error in if (any(e2@year != 0)) { : missing value where TRUE/FALSE needed
The second command creates an error when NA is expected.
Here an example:
The second command creates an error when
NAis expected.