Skip to content

assign value using day(), minute(), etc., will yield error when providing empty input #517

@iwccsbfb

Description

@iwccsbfb

Example as below:

> a <- c(Sys.Date(), Sys.Date()+1)
> a
[1] "2017-02-09" "2017-02-10"
> day(a[c(F,F)])
integer(0)
> day(a[c(F,F)]) <- 10
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 0, 1

Whereas in normal R functions, it should just do nothing and do not yield an error:

> b <- 1:2
> b[c(F,F)]
numeric(0)
> b[c(F,F)] <- 10
> b
[1] 1 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions