I have a set of date-bound values, like:
2015-01-01 1
2015-01-02 4
etc.
I would like to compare different years data by "normalizing" it like this:
Value2014 Value2015
1900-01-01 1 5
1900-01-02 4
etc.
This "Value2014/2015" columns sort of make me "shame on me".. What if tomorrow I'll have another set of years to process ? That should not be so much hardcoded, I feel
Would not it be more "pretty" (not know how much practical, but still), to have it like that:
Value
1900-01-01 (1;5)
1900-01-02 (;4)
etc.
I've played with:
v <- list()
v[[1]] <- c(1,2,3)
v[[2]] <- c(1,0,0)
dv <- data.frame(dates = c("2014-01-02","2014-01-03"),values = v)
...and it ends with
Error in data.frame(dates = c("2014-01-02", "2014-01-03"), values = v) : arguments imply differing number of rows: 2, 3
Apparently, data.frame "parses into" v and tries to convert v[[1]] and v[[2]] as separate columns.
Should I "forget about that" or are there more appropriate expressions for this ?
Thanks!