-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
This was fixed for summarise (#252), but still occurs with mutate (only on a grouped df). This is with the current development version of dplyr:
require(lubridate)
require(dplyr)
test.df <- structure(
list(ID = c(rep(1,20),rep(2,20)),
Date = structure(c(-247320000, -246196800, -245073600, -243864000,
-242654400, -241444800, -126273600, -123595200,
-121176000, -118497600, 1359385200, 1359388800,
1359392400, 1359396000, 1359399600, 1359403200,
1359406800, 1359410400, 1359414000, 1359417600,
55598400, 56116800, 58881600, 62078400, 64756800,
67348800, 69854400, 72964800, 76161600, 79012800,
1358589600, 1358676000, 1358762400, 1358848800,
1358935200, 1359021600, 1359108000, 1359194400,
1359280800, 1359367200), tzone = "GMT",
class = c("POSIXct", "POSIXt")),
Val=rnorm(40)),
.Names = c("ID", "Date", "Val"), row.names = c(NA, 40L),
class = "data.frame")
out.df <- group_by(test.df, ID, fl_date=floor_date(Date, unit="month")) %.%
mutate(length_x=n(), summary_date =
if (n() < 5) round_date(Date, "month") else floor_date(Date, "day"))
attr(out.df$summary_date, "tzone") # This is null
This works:
out2.df <-test.df %.% mutate(summary_date = round_date(Date, "month"))
attr(out2.df$summary_date, "tzone") # "GMT"
I left this as a comment in #252 after it was closed, so I thought it may have been lost - my apologies if it's already been captured.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels