Skip to content

bind_rows with POSIXt columns generated by seq.POSIXt #1402

@erikriverson

Description

@erikriverson

Not sure if this is the intended behavior of bind_rows or not, but I wanted to put it down in case anyone else runs across this behavior. This example is using version 0.4.3.

library(dplyr)
now <- Sys.time()

df1 <- data.frame(time = now)
class(df1$time) # [1] "POSIXct" "POSIXt" 
typeof(df1$time) # [1] "double"
class(bind_rows(df1)$time) # [1] "POSIXct" "POSIXt" 

df2 <- data.frame(time = seq(now, length.out = 1, by = 1))
class(df2$time) # [1] "POSIXct" "POSIXt" 
typeof(df2$time) # [1] "integer"
class(bind_rows(df2)$time) # [1] "integer"

As another way of seeing the difference between df1 and df2, compare dput(df1) and dput(df2) The class(es) of the objects are identical, but the underlying storage type is not, which leads to a difference in behavior when bind_rows is called.

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