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
Labels

Comments

@iwccsbfb
Copy link

@iwccsbfb iwccsbfb 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
Copy link
Member

@vspinu vspinu commented Feb 9, 2017

Yes. This is a bug.

Loading

@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
[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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants