Skip to content

Difficult to understand error message for a input of a double with attributes #84

@billdenney

Description

@billdenney

This is related to tidyverse/dplyr#5343 in that the issue there is what made me find this issue. Otherwise, the issues are unrelated.

When a double vector with attributes is passed into as_hms() but not hms(), it gives an error that does not indicate the actual problem. I believe that the actual problem is that there are attributes, and the message below does not indicate that. In my real example, I loaded a SAS dataset, and those always come with attributes that I always ignore.

library(hms)
A1 <- structure(1, A="A")
hms(A1)
#> 00:00:01
as_hms(A1)
#> Error: `x` must be a vector with type <double>.
#> Instead, it has type <double>.
A1 <- 1
hms(A1)
#> 00:00:01
as_hms(A1)
#> 00:00:01

Created on 2020-06-19 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions