Skip to content

summarise on Date column: min with na.rm=TRUE returns wrong value #755

@alexploner

Description

@alexploner

Unexpected behaviour when summarising a Date-variable using min (or max) under R 3.1.1, dplyr 0.3.0.2, Windows 7:

dates = as.Date(c("2014-01-01", "2013-01-01"))
dd = data.frame(Dates = dates)

Summarizing works fine:

require(dplyr)
summarise(dd, min(Dates))
##  min(Dates)
##1 2013-01-01

... except if I set add.rm=TRUE:

summarise(dd, min(Dates, na.rm=TRUE))
##  min(Dates, na.rm = TRUE)
##1               1970-01-01

Some implicit type conversion along the way?

Metadata

Metadata

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions