У меня есть вывод, как показано ниже;
В моем выводе есть несколько таких кластеров. Как видите, есть 2 столбца (день 1 и день 2). Я хочу извлечь (или экспортировать) кадры данных, которые начинаются с Hour_1
для каждого дня.
Итак, для Cluster 1
я хочу иметь 2 кадра данных, один начинается с 0.00, 0, 0...
и продолжается до Hour_24
, а другой начинается с 1.07, 0, 0...
и продолжается до Hour_24
, тоже.
Вот структура моих данных;
v1<-structure(list(`Cluster 1` = structure(list(Day = c(1, 2), Season = c(1,
1), Year = c(2011, 2011), Daily = c(1.48, 2.53), Hour_1 = c(0,
1.07), Hour_2 = c(0, 0), Hour_3 = c(0, 0), Hour_4 = c(0, 0),
Hour_5 = c(0, 0), Hour_6 = c(0, 1.27), Hour_7 = c(0, 0.19
), Hour_8 = c(0, 0), Hour_9 = c(0, 0), Hour_10 = c(0, 0),
Hour_11 = c(0, 0), Hour_12 = c(0, 0), Hour_13 = c(0, 0),
Hour_14 = c(0, 0), Hour_15 = c(0, 0), Hour_16 = c(0, 0),
Hour_17 = c(0, 0), Hour_18 = c(0.041, 0), Hour_19 = c(0.673,
0), Hour_20 = c(0, 0), Hour_21 = c(0, 0), Hour_22 = c(0,
0), Hour_23 = c(0.319, 0), Hour_24 = c(0.447, 0)), .Names = c("Day",
"Season", "Year", "Daily", "Hour_1", "Hour_2", "Hour_3", "Hour_4",
"Hour_5", "Hour_6", "Hour_7", "Hour_8", "Hour_9", "Hour_10",
"Hour_11", "Hour_12", "Hour_13", "Hour_14", "Hour_15", "Hour_16",
"Hour_17", "Hour_18", "Hour_19", "Hour_20", "Hour_21", "Hour_22",
"Hour_23", "Hour_24"), row.names = c("Day_1", "Day_2"), class = "data.frame"),
`Cluster 2` = structure(list(Day = c(7, 8), Season = c(1,
1), Year = c(2011, 2011), Daily = c(0.19, 0.75), Hour_1 = c(0,
0), Hour_2 = c(0, 0.521), Hour_3 = c(0, 0.229), Hour_4 = c(0,
0), Hour_5 = c(0, 0), Hour_6 = c(0, 0), Hour_7 = c(0, 0),
Hour_8 = c(0, 0), Hour_9 = c(0, 0), Hour_10 = c(0, 0),
Hour_11 = c(0, 0), Hour_12 = c(0, 0), Hour_13 = c(0,
0), Hour_14 = c(0, 0), Hour_15 = c(0, 0), Hour_16 = c(0,
0), Hour_17 = c(0.189, 0), Hour_18 = c(0.001, 0), Hour_19 = c(0,
0), Hour_20 = c(0, 0), Hour_21 = c(0, 0), Hour_22 = c(0,
0), Hour_23 = c(0, 0), Hour_24 = c(0, 0)), .Names = c("Day",
"Season", "Year", "Daily", "Hour_1", "Hour_2", "Hour_3",
"Hour_4", "Hour_5", "Hour_6", "Hour_7", "Hour_8", "Hour_9",
"Hour_10", "Hour_11", "Hour_12", "Hour_13", "Hour_14", "Hour_15",
"Hour_16", "Hour_17", "Hour_18", "Hour_19", "Hour_20", "Hour_21",
"Hour_22", "Hour_23", "Hour_24"), row.names = c("Day_3",
"Day_4"), class = "data.frame")), .Names = c("Cluster 1",
"Cluster 2"))