我只是想知道,如果你能引導我,我怎麼能重塑基於特定標準的數據集的正確方向小時安排,例如,我有follwing例如數據集: 重塑數據集
我試圖重塑數據集是這樣的:
我怎麼能繼續此整形嗎?非常感謝。
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))
+1我還在打字。 'reshape'包和'cast'會做同樣的事情。 'cast(data,date + day〜hour,value ='Value')' – Justin 2012-04-12 19:52:11
感謝Brian和Justin,這就是我想要了解如何整體重塑的原因。再次感謝,問候# – Achak 2012-04-12 19:55:49