Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iwccsbfb opened this issue Feb 9, 2017 · 1 comment

Comments

@iwccsbfb
Copy link

commented Feb 9, 2017

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

@vspinu

This comment has been minimized.

Copy link
Member

commented Feb 9, 2017

Yes. This is a bug.

@vspinu vspinu added the bug label Feb 9, 2017

timgoodman pushed a commit to timgoodman/lubridate that referenced this issue Mar 8, 2017

@vspinu vspinu closed this in 7e4b209 Mar 9, 2017

vspinu added a commit that referenced this issue Mar 9, 2017

Merge pull request #525 from timgoodman/master
[Fix #517] `day<-`, `minute<-`, etc. should not produce an error when…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.