Skip to content

bind_rows POSIXct bug #1125

@blasern

Description

@blasern

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)))

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions