I have a df with this structure (date have date format, value is numeric and name is character)
lows <- data.frame(
stringsAsFactors = FALSE,
name = c("1º2004","2º2004","3º2004",
"4º2004","1º2005","2º2005","3º2005","4º2005"),
value = c(299L, 395L, 361L, 333L, 288L, 286L, 352L, 406L),
date = c("2004-01-01","2004-04-01",
"2004-07-01","2004-10-01","2005-01-01","2005-04-01",
"2005-07-01","2005-10-01")
)
Now, I want to obtain the total value for each year, not for each quarter, i.e. 2004 =299+395+361+333, that is 1388 and so on... and made a new dataframe with this results, something like name=2004, value=1388, date=2004 and so on. Any idea? Maybe with lubridate?