I am just wondering if you could guide me to the right direction about how can I reshape a dataset based on a specific criteria to arrange by hours, for example, I have the follwing example dataset:
I am trying to reshape the dataset to look like this:
how can I proceed with this reshaping please? Many Thanks.
My sample data:
data = structure(list(date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L), .Label = "Jan-97", class = "factor"), day = c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), hour = c(1L, 2L,
3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), Value = c(65L, 29L,
31L, 42L, 42L, 52L, 61L, 57L, 55L, 52L, 57L, 46L)), .Names = c("date",
"day", "hour", "Value"), class = "data.frame", row.names = c(NA,
-12L))
See Question&Answers more detail:
os