Skip to content

Keep Date class when performing a mean calculation #1023

Closed

Description

@DavidArenburg
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

Activity

  1. added this to the v1.9.6 milestone on Jan 27, 2015
  2. DavidArenburg commented on Jan 27, 2015

    @DavidArenburg
    MemberAuthor

    @Arun you are awesome

  3. arunsrinivasan commented on Jan 27, 2015

    @arunsrinivasan
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions