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

Keep Date class when performing a mean calculation #1023

Closed
DavidArenburg opened this issue Jan 27, 2015 · 2 comments
Closed

Keep Date class when performing a mean calculation #1023

DavidArenburg opened this issue Jan 27, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@DavidArenburg
Copy link
Member

library(data.table)
DT <- data.table(Period = rep(1:3, each = 3), Date = as.Date(seq(Sys.Date(), (Sys.Date() + 8), by = "day")))

aggregate(Date ~ Period, DT, mean)
#   Period       Date
#1      1 2015-01-28
#2      2 2015-01-31
#3      3 2015-02-03

DT[, .(mean(Date)), Period]
#    Period    V1
#1:      1 16463
#2:      2 16466
#3:      3 16469
@arunsrinivasan arunsrinivasan self-assigned this Jan 27, 2015
@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Jan 27, 2015
@DavidArenburg
Copy link
Member Author

@Arun you are awesome

@arunsrinivasan
Copy link
Member

@DavidArenburg 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants