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

bind_rows POSIXct bug #1125

Closed
blasern opened this issue May 5, 2015 · 1 comment
Closed

bind_rows POSIXct bug #1125

blasern opened this issue May 5, 2015 · 1 comment
Assignees
Milestone

Comments

@blasern
Copy link

blasern commented May 5, 2015

The bind_rows function seems to have difficulties handeling as.POSIXct(NA). It also returns the rather unhelpful message

POSIXct, POSIXt incompatible with data of type: POSIXct, POSIXt

Below are some simple examples.

# bind_rows does not work
bind_rows(data.frame(date = as.POSIXct(NA)), 
          data.frame(date = as.POSIXct("2015-05-05")))
## Error during wrapup: incompatible type (data index: 2, column: 'date', was collecting: POSIXct, 
## POSIXt (dplyr::POSIXctCollecter<14>), incompatible with data of type: POSIXct, POSIXt

# same with rbind works
rbind(data.frame(date = as.POSIXct(NA)), 
      data.frame(date = as.POSIXct("2015-05-05")))

# funny that this works with logical NA 
bind_rows(data.frame(date = NA), 
          data.frame(date = as.POSIXct("2015-05-05")))

# also it works the other way around
bind_rows(data.frame(date = as.POSIXct("2015-05-05")), 
          data.frame(date = as.POSIXct(NA)))
@blasern
Copy link
Author

blasern commented May 5, 2015

This may be an issue with timezones?

dput(as.POSIXct(NA))
## structure(NA_real_, class = c("POSIXct", "POSIXt"))
dput(as.POSIXct("2015-05-05"))
## structure(1430776800, class = c("POSIXct", "POSIXt"), tzone = "")

The two versions with the same timezones work:

bind_rows(data.frame(date = structure(NA_real_, class = c("POSIXct", "POSIXt"), tzone = "")), 
          data.frame(date = structure(1430776800, class = c("POSIXct", "POSIXt"), tzone = "")))
bind_rows(data.frame(date = structure(NA_real_, class = c("POSIXct", "POSIXt"))), 
          data.frame(date = structure(1430776800, class = c("POSIXct", "POSIXt"))))

@hadley hadley added this to the 0.5 milestone May 19, 2015
@romainfrancois romainfrancois self-assigned this Jul 15, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants