I\'m struggling with something very basic: sorting a data frame based on a time format (month-year, or, “%B-%y” in this case). My goal is to calculate various monthly statis
An old post but worthy of a data.table
approach:
Read in data and set local as described by @caracal
> Sys.setlocale(category="LC_TIME", locale="Dutch_Belgium.1252")
[1] "Dutch_Belgium.1252"
> tmp09 <- read.table(file="clipboard", header=TRUE)
> tmp09$ExitTime <- as.Date(tmp09$ExitTime)
Summarise data as requested
require(data.table)
> data.table(tmp09)[,
+ .(Tmp09Total = sum(AccountValue)),
+ by = .(Date = format(ExitTime, "%B-%y"))]
Date Tmp09Total
1: april-07 6997
2: mei-07 21197
3: juli-07 29147
4: augustus-07 7897
5: november-07 7423