Skip to contents

Check that the type of a time column is valid.

Usage

validate_time_column(times)

Arguments

times

A vector, presumably a time column

Value

NULL if valid, error otherwise

Examples

# valid
casteval:::validate_time_column(c(1,2,3))
casteval:::validate_time_column(lubridate::as_date(1000:1010))
casteval:::validate_time_column(lubridate::as_datetime(10000:10100))

# invalid
try(casteval:::validate_time_column(list(1,2,3)))
#> Error in casteval:::validate_time_column(list(1, 2, 3)) : 
#>   time column must be either numeric, Date, or date-time (POSIXt) vector
try(casteval:::validate_time_column(c("monday", "tuesday")))
#> Error in casteval:::validate_time_column(c("monday", "tuesday")) : 
#>   time column must be either numeric, Date, or date-time (POSIXt) vector