Skip to content

Add NA_Date_ and 0-length Date helpers #681

@AshesITR

Description

@AshesITR

Sometimes I find the need to explicitly set a date to NA (or specify an empty Date vector).
The former would be

NA_Date_ <- structure(NA_real_, class = "Date")

This is especially useful in conjuction with dplyr::if_else wich will error out on
dplyr::if_else(FALSE, NA_real_, lubridate::today()) and any other NA_...

The latter would be

Date <- function(length = 0L)structure(rep(NA_real_, length), class = "Date")

wich is very useful in allocating an empty data.frame with a date column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions