library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ✔ dplyr 1.1.2 ✔ readr 2.1.4 ✔ forcats 1.0.0 ✔ stringr 1.5.0 ✔ ggplot2 3.4.2 ✔ tibble 3.2.1 ✔ lubridate 1.9.2 ✔ tidyr 1.3.0 ✔ purrr 1.0.1 ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag() ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
set.seed(42)
"A B C D E F" %>% str_split(" ") %>% unlist %>% sample %>% str_c(collapse=" → ")
Realisierte_Erzeugung_201501010000_202305301300_Stunde.csv
as a table into R :heavy_check_mark:Time
containing the combined info from Datum
and Anfang
data <- read_csv2(
"../data_dojo_22/Realisierte_Erzeugung_201501010000_202305301300_Stunde.csv",
col_types=cols(`Datum` = col_date("%d.%m.%Y")),
na="-"
)
ℹ Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
colnames(data) <- colnames(data) %>% str_remove(" \\[.*") %>% str_replace(" ","_")
data
Datum | Anfang | Ende | Biomasse | Wasserkraft | Wind_Offshore | Wind_Onshore | Photovoltaik | Sonstige_Erneuerbare | Kernenergie | Braunkohle | Steinkohle | Erdgas | Pumpspeicher | Sonstige_Konventionelle |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<date> | <time> | <time> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
2015-01-01 | 00:00:00 | 01:00:00 | 4024.25 | 1158.25 | 516.50 | 8128.00 | 0.00 | 133.00 | 10710.50 | 15687.25 | 3219.75 | 1226.25 | 1525.75 | 4909.25 |
2015-01-01 | 01:00:00 | 02:00:00 | 3982.75 | 1188.00 | 516.25 | 8297.50 | 0.00 | 122.50 | 11086.25 | 15321.75 | 2351.25 | 870.75 | 1079.25 | 4932.75 |
2015-01-01 | 02:00:00 | 03:00:00 | 4019.50 | 1139.25 | 514.00 | 8540.00 | 0.00 | 93.00 | 11026.25 | 14817.50 | 2227.00 | 809.50 | 787.00 | 5041.75 |
2015-01-01 | 03:00:00 | 04:00:00 | 4040.75 | 1122.50 | 517.75 | 8552.00 | 0.00 | 86.50 | 11027.75 | 14075.00 | 2339.75 | 821.00 | 287.75 | 5084.00 |
2015-01-01 | 04:00:00 | 05:00:00 | 4037.75 | 1112.00 | 519.75 | 8643.50 | 0.00 | 86.50 | 10962.25 | 14115.00 | 2461.50 | 831.25 | 346.75 | 5070.75 |
2015-01-01 | 05:00:00 | 06:00:00 | 4028.25 | 1107.75 | 520.00 | 8711.75 | 0.00 | 86.75 | 10696.00 | 13474.25 | 2217.75 | 851.00 | 765.50 | 5096.75 |
2015-01-01 | 06:00:00 | 07:00:00 | 4013.25 | 1111.75 | 521.50 | 9167.25 | 0.00 | 87.00 | 10299.50 | 12403.75 | 2373.25 | 868.25 | 414.50 | 5153.00 |
2015-01-01 | 07:00:00 | 08:00:00 | 4012.75 | 1113.75 | 520.25 | 9811.00 | 0.00 | 87.00 | 10035.25 | 12062.50 | 2491.00 | 876.00 | 582.50 | 5161.00 |
2015-01-01 | 08:00:00 | 09:00:00 | 3999.75 | 1107.50 | 525.25 | 9683.00 | 53.00 | 87.00 | 10245.75 | 12405.00 | 2530.25 | 888.25 | 750.50 | 5393.50 |
2015-01-01 | 09:00:00 | 10:00:00 | 4016.25 | 1121.00 | 527.00 | 9501.75 | 773.25 | 85.75 | 10060.25 | 12798.75 | 2386.25 | 891.50 | 387.00 | 5884.00 |
2015-01-01 | 10:00:00 | 11:00:00 | 4007.75 | 1122.00 | 525.00 | 10025.00 | 2116.75 | 82.00 | 10082.25 | 12728.50 | 2557.00 | 888.25 | 176.25 | 6064.00 |
2015-01-01 | 11:00:00 | 12:00:00 | 4011.75 | 1146.25 | 527.25 | 10862.50 | 3364.25 | 82.00 | 9949.00 | 12451.00 | 2657.75 | 876.50 | 884.50 | 5914.75 |
2015-01-01 | 12:00:00 | 13:00:00 | 4014.00 | 1139.75 | 527.75 | 11575.25 | 4198.25 | 82.00 | 10119.00 | 12464.50 | 2937.75 | 874.25 | 705.00 | 5778.25 |
2015-01-01 | 13:00:00 | 14:00:00 | 4005.50 | 1128.00 | 527.75 | 11977.25 | 3500.50 | 84.50 | 10453.50 | 12417.75 | 2810.25 | 883.50 | 967.25 | 5808.75 |
2015-01-01 | 14:00:00 | 15:00:00 | 4024.25 | 1154.75 | 524.75 | 11396.00 | 2278.75 | 87.00 | 10828.25 | 12621.50 | 2664.00 | 890.25 | 1176.25 | 5842.50 |
2015-01-01 | 15:00:00 | 16:00:00 | 4028.75 | 1160.00 | 524.50 | 11326.50 | 745.50 | 86.00 | 11069.75 | 13387.25 | 2485.25 | 969.25 | 1663.00 | 6075.25 |
2015-01-01 | 16:00:00 | 17:00:00 | 4030.75 | 1145.75 | 524.50 | 13058.00 | 50.00 | 82.00 | 11006.50 | 14679.00 | 2668.75 | 1085.25 | 1227.00 | 5946.00 |
2015-01-01 | 17:00:00 | 18:00:00 | 4029.25 | 1171.50 | 524.50 | 14911.50 | 0.00 | 82.25 | 11057.50 | 14964.25 | 2808.75 | 1193.75 | 1597.75 | 5464.50 |
2015-01-01 | 18:00:00 | 19:00:00 | 4027.50 | 1168.50 | 524.00 | 16344.00 | 0.00 | 86.00 | 10930.25 | 14286.00 | 2690.25 | 1135.50 | 1320.00 | 5604.00 |
2015-01-01 | 19:00:00 | 20:00:00 | 4002.75 | 1157.75 | 523.50 | 17484.50 | 0.00 | 87.75 | 10861.75 | 13498.00 | 2490.75 | 1123.75 | 1535.50 | 5866.25 |
2015-01-01 | 20:00:00 | 21:00:00 | 3991.50 | 1168.25 | 522.25 | 18659.00 | 0.00 | 88.00 | 10343.00 | 12366.00 | 2440.00 | 1209.25 | 1162.75 | 5861.25 |
2015-01-01 | 21:00:00 | 22:00:00 | 3990.25 | 1186.50 | 521.00 | 19831.50 | 0.00 | 88.00 | 9840.00 | 11284.75 | 2409.00 | 1205.75 | 838.75 | 6090.75 |
2015-01-01 | 22:00:00 | 23:00:00 | 4000.00 | 1170.25 | 519.50 | 20716.00 | 0.00 | 88.00 | 9749.00 | 10428.50 | 2298.75 | 1324.25 | 2066.75 | 6084.75 |
2015-01-01 | 23:00:00 | 00:00:00 | 4002.00 | 1162.00 | 494.00 | 21589.00 | 0.00 | 88.00 | 9045.75 | 9861.25 | 2209.25 | 1212.75 | 1436.25 | 5989.25 |
2015-01-02 | 00:00:00 | 01:00:00 | 3999.75 | 1122.00 | 305.00 | 22166.75 | 0.00 | 88.00 | 8164.75 | 9035.50 | 2225.50 | 1172.00 | 1301.00 | 5978.00 |
2015-01-02 | 01:00:00 | 02:00:00 | 4003.25 | 1129.25 | 276.50 | 23158.00 | 0.00 | 87.75 | 7147.75 | 9013.50 | 2188.75 | 1127.75 | 893.50 | 6370.75 |
2015-01-02 | 02:00:00 | 03:00:00 | 3997.25 | 1124.25 | 282.00 | 23966.00 | 0.00 | 87.75 | 6675.75 | 9018.50 | 1974.50 | 1123.25 | 608.50 | 5873.75 |
2015-01-02 | 03:00:00 | 04:00:00 | 4000.00 | 1133.25 | 324.75 | 24708.75 | 0.00 | 87.75 | 6466.75 | 8765.00 | 1907.00 | 1120.25 | 203.50 | 5858.00 |
2015-01-02 | 04:00:00 | 05:00:00 | 3992.00 | 1122.25 | 335.00 | 25386.00 | 0.00 | 88.00 | 6304.00 | 8398.25 | 2098.75 | 1129.75 | 712.50 | 6012.75 |
2015-01-02 | 05:00:00 | 06:00:00 | 3981.50 | 1100.75 | 388.25 | 25783.75 | 0.00 | 88.00 | 6760.00 | 8593.00 | 2406.00 | 1157.50 | 729.25 | 6221.25 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
2023-05-29 | 07:00:00 | 08:00:00 | 4489.00 | 2074.50 | 2402.00 | 6005.75 | 9430.50 | 117.00 | 0 | 3455.75 | 1583.25 | 2201.25 | 1292.75 | 1444.75 |
2023-05-29 | 08:00:00 | 09:00:00 | 4523.25 | 2068.75 | 2560.00 | 4323.75 | 17827.00 | 117.00 | 0 | 3462.50 | 1812.00 | 2127.00 | 935.00 | 1448.00 |
2023-05-29 | 09:00:00 | 10:00:00 | 4571.75 | 2071.50 | 2365.50 | 3468.75 | 25662.25 | 117.00 | 0 | 3450.25 | 1726.00 | 2052.25 | 476.00 | 1449.75 |
2023-05-29 | 10:00:00 | 11:00:00 | 4579.00 | 2072.00 | 1576.25 | 3647.00 | 31928.50 | 117.00 | 0 | 3450.75 | 1691.75 | 2025.00 | 215.75 | 1448.00 |
2023-05-29 | 11:00:00 | 12:00:00 | 4594.75 | 2032.25 | 1447.50 | 3519.50 | 35927.00 | 117.00 | 0 | 3424.25 | 1684.25 | 2041.00 | 225.00 | 1445.75 |
2023-05-29 | 12:00:00 | 13:00:00 | 4584.25 | 1643.00 | 1128.25 | 3267.25 | 37681.50 | 117.00 | 0 | 3176.25 | 1464.75 | 2029.00 | 152.00 | 1433.75 |
2023-05-29 | 13:00:00 | 14:00:00 | 4545.50 | 1598.75 | 855.00 | 3471.75 | 37628.50 | 117.00 | 0 | 3178.00 | 1290.50 | 2043.75 | 161.25 | 1439.25 |
2023-05-29 | 14:00:00 | 15:00:00 | 4509.75 | 1574.50 | 697.00 | 3401.00 | 35503.25 | 117.00 | 0 | 3166.25 | 1273.00 | 2062.25 | 19.75 | 1419.00 |
2023-05-29 | 15:00:00 | 16:00:00 | 4482.50 | 1518.25 | 1243.25 | 4111.75 | 31892.50 | 117.00 | 0 | 3169.50 | 1266.50 | 2077.50 | 2.50 | 1386.75 |
2023-05-29 | 16:00:00 | 17:00:00 | 4458.00 | 1648.50 | 2406.50 | 7099.50 | 27421.75 | 117.25 | 0 | 3174.50 | 1282.50 | 2055.00 | 11.25 | 1408.25 |
2023-05-29 | 17:00:00 | 18:00:00 | 4449.50 | 2067.25 | 2649.50 | 9514.00 | 20541.50 | 125.75 | 0 | 3390.75 | 1326.00 | 2118.50 | 109.75 | 1421.50 |
2023-05-29 | 18:00:00 | 19:00:00 | 4465.00 | 2099.00 | 4183.50 | 12215.50 | 12323.25 | 126.00 | 0 | 3441.50 | 1375.00 | 2348.75 | 360.00 | 1405.75 |
2023-05-29 | 19:00:00 | 20:00:00 | 4508.25 | 2099.50 | 4259.75 | 13248.00 | 5363.50 | 134.25 | 0 | 3643.25 | 1350.25 | 3261.25 | 815.00 | 1384.25 |
2023-05-29 | 20:00:00 | 21:00:00 | 4562.00 | 2144.00 | 4221.00 | 13197.00 | 1635.00 | 133.25 | 0 | 3861.00 | 1323.00 | 3647.75 | 1620.50 | 1174.00 |
2023-05-29 | 21:00:00 | 22:00:00 | 4600.50 | 2119.50 | 4300.25 | 14307.75 | 79.00 | 132.75 | 0 | 4030.00 | 1422.50 | 3970.75 | 1577.00 | 1170.50 |
2023-05-29 | 22:00:00 | 23:00:00 | 4634.25 | 2117.50 | 4509.25 | 14627.50 | 0.00 | 123.00 | 0 | 3946.75 | 1466.00 | 3681.75 | 1807.75 | 1154.50 |
2023-05-29 | 23:00:00 | 00:00:00 | 4651.25 | 2066.50 | 4647.25 | 14237.50 | 0.00 | 122.00 | 0 | 3713.00 | 1368.25 | 3729.75 | 900.25 | 1154.25 |
2023-05-30 | 00:00:00 | 01:00:00 | 4629.75 | 1968.00 | 4278.75 | 13122.75 | 0.00 | 120.00 | 0 | 3735.25 | 1313.75 | 3710.00 | 625.25 | 1147.50 |
2023-05-30 | 01:00:00 | 02:00:00 | 4581.50 | 2033.75 | 3891.75 | 11488.50 | 0.00 | 119.50 | 0 | 3523.50 | 1288.50 | 3984.75 | 769.25 | 1146.00 |
2023-05-30 | 02:00:00 | 03:00:00 | 4551.00 | 1963.50 | 3725.50 | 10141.00 | 0.00 | 119.00 | 0 | 3484.25 | 1263.75 | 3592.00 | 604.25 | 1141.75 |
2023-05-30 | 03:00:00 | 04:00:00 | 4503.25 | 2090.50 | 3635.25 | 9170.25 | 0.00 | 119.00 | 0 | 3490.00 | 1272.50 | 4030.50 | 578.75 | 1132.50 |
2023-05-30 | 04:00:00 | 05:00:00 | 4454.25 | 2105.25 | 3635.75 | 8735.75 | 2.25 | 120.00 | 0 | 3678.25 | 1275.00 | 4895.50 | 433.25 | 1136.00 |
2023-05-30 | 05:00:00 | 06:00:00 | 4406.75 | 2134.75 | 2940.00 | 8419.75 | 407.75 | 120.25 | 0 | 4087.50 | 1289.25 | 5723.75 | 404.25 | 1142.25 |
2023-05-30 | 06:00:00 | 07:00:00 | 4413.25 | 2227.50 | 2272.50 | 7531.00 | 2888.75 | 128.25 | 0 | 5010.75 | 1362.00 | 6525.25 | 2803.75 | 1144.50 |
2023-05-30 | 07:00:00 | 08:00:00 | 4468.00 | 2276.50 | 1916.25 | 5507.25 | 8343.25 | 137.00 | 0 | 5275.50 | 1173.75 | 6905.75 | 5712.75 | 1156.75 |
2023-05-30 | 08:00:00 | 09:00:00 | 4503.50 | 2152.50 | 1643.25 | 3647.75 | 15893.25 | 138.00 | 0 | 5181.75 | 1196.25 | 6946.50 | 5079.50 | 1132.00 |
2023-05-30 | 09:00:00 | 10:00:00 | 4544.50 | 2156.25 | 1285.00 | 2900.50 | 23612.50 | 135.00 | 0 | 4707.50 | 1114.75 | 6384.50 | 2122.75 | 1115.00 |
2023-05-30 | 10:00:00 | 11:00:00 | 4568.25 | 2085.25 | 1241.25 | 2729.50 | 30341.75 | 121.25 | 0 | 3978.50 | 1095.50 | 4802.50 | 1279.00 | 1096.25 |
2023-05-30 | 11:00:00 | 12:00:00 | 4618.75 | 2068.25 | 1053.25 | 3115.00 | 35196.25 | 119.00 | 0 | 3759.75 | 1151.50 | 3762.25 | 774.00 | 1096.50 |
2023-05-30 | 12:00:00 | 13:00:00 | 4612.25 | 1967.25 | 781.25 | 3496.25 | 37030.00 | 119.00 | 0 | 3765.00 | 1296.75 | 3240.00 | 196.75 | 1099.75 |
Time
columndata <- data %>%
mutate(year = Datum) %>%
unite("Time", Datum:Anfang)
head(data)
Time | Ende | Biomasse | Wasserkraft | Wind_Offshore | Wind_Onshore | Photovoltaik | Sonstige_Erneuerbare | Kernenergie | Braunkohle | Steinkohle | Erdgas | Pumpspeicher | Sonstige_Konventionelle | year |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<chr> | <time> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <date> |
2015-01-01_00:00:00 | 01:00:00 | 4024.25 | 1158.25 | 516.50 | 8128.00 | 0 | 133.00 | 10710.50 | 15687.25 | 3219.75 | 1226.25 | 1525.75 | 4909.25 | 2015-01-01 |
2015-01-01_01:00:00 | 02:00:00 | 3982.75 | 1188.00 | 516.25 | 8297.50 | 0 | 122.50 | 11086.25 | 15321.75 | 2351.25 | 870.75 | 1079.25 | 4932.75 | 2015-01-01 |
2015-01-01_02:00:00 | 03:00:00 | 4019.50 | 1139.25 | 514.00 | 8540.00 | 0 | 93.00 | 11026.25 | 14817.50 | 2227.00 | 809.50 | 787.00 | 5041.75 | 2015-01-01 |
2015-01-01_03:00:00 | 04:00:00 | 4040.75 | 1122.50 | 517.75 | 8552.00 | 0 | 86.50 | 11027.75 | 14075.00 | 2339.75 | 821.00 | 287.75 | 5084.00 | 2015-01-01 |
2015-01-01_04:00:00 | 05:00:00 | 4037.75 | 1112.00 | 519.75 | 8643.50 | 0 | 86.50 | 10962.25 | 14115.00 | 2461.50 | 831.25 | 346.75 | 5070.75 | 2015-01-01 |
2015-01-01_05:00:00 | 06:00:00 | 4028.25 | 1107.75 | 520.00 | 8711.75 | 0 | 86.75 | 10696.00 | 13474.25 | 2217.75 | 851.00 | 765.50 | 5096.75 | 2015-01-01 |
nrow(data)
training_data <- data %>%
filter(between(year, as.Date("2015-01-01"), as.Date("2021-05-30")))
validation_data <- data %>%
filter(between(year, as.Date("2021-05-31"), as.Date("2022-05-30")))
test_data <- data %>%
filter(between(year, as.Date("2022-05-31"), as.Date("2023-05-30")))
tail(training_data)
Time | Ende | Biomasse | Wasserkraft | Wind_Offshore | Wind_Onshore | Photovoltaik | Sonstige_Erneuerbare | Kernenergie | Braunkohle | Steinkohle | Erdgas | Pumpspeicher | Sonstige_Konventionelle | year |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<chr> | <time> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <date> |
2021-05-30_18:00:00 | 19:00:00 | 4599.25 | 1955.50 | 203.50 | 5483.75 | 11433.50 | 148.00 | 7842.75 | 7016.25 | 2075.25 | 3636.00 | 431.0 | 1369.50 | 2021-05-30 |
2021-05-30_19:00:00 | 20:00:00 | 4644.25 | 2012.50 | 228.00 | 5009.25 | 4841.75 | 148.00 | 7901.25 | 8593.75 | 2258.75 | 4068.00 | 1388.5 | 1350.50 | 2021-05-30 |
2021-05-30_20:00:00 | 21:00:00 | 4677.50 | 1986.75 | 286.50 | 4443.50 | 1270.25 | 148.75 | 7903.00 | 9298.50 | 2327.50 | 4063.25 | 1868.5 | 1339.00 | 2021-05-30 |
2021-05-30_21:00:00 | 22:00:00 | 4640.50 | 2015.50 | 240.50 | 5177.00 | 58.50 | 150.25 | 7904.25 | 9402.50 | 2355.25 | 3998.75 | 2516.0 | 1356.50 | 2021-05-30 |
2021-05-30_22:00:00 | 23:00:00 | 4572.50 | 1965.50 | 224.75 | 6339.75 | 0.00 | 151.00 | 7911.50 | 9450.00 | 2353.25 | 3947.25 | 1863.5 | 1355.75 | 2021-05-30 |
2021-05-30_23:00:00 | 00:00:00 | 4512.75 | 1933.00 | 209.50 | 7019.25 | 0.00 | 151.75 | 7898.00 | 9474.25 | 2257.75 | 3840.25 | 824.5 | 1355.75 | 2021-05-30 |
Warning message in xy.coords(x, y, xlabel, ylabel, log): “NAs introduced by coercion” Warning message in min(x): “no non-missing arguments to min; returning Inf” Warning message in max(x): “no non-missing arguments to max; returning -Inf” WARNING: Some output was deleted.
plot(training_data$Photovoltaik,type="l",col="yellow")
lines(training_data$Wind_Offshore,type="l",col="gray")
lines(training_data$Wasserkraft,type="l",col="blue")
plot(training_data$Wasserkraft,type="l",col="blue")
aggregate(training_data$Wasserkraft, list(training_data$year), FUN=mean)
Group.1 | x |
---|---|
<date> | <dbl> |
2015-01-01 | 1144.292 |
2015-01-02 | 1128.656 |
2015-01-03 | 1297.323 |
2015-01-04 | 1758.844 |
2015-01-05 | 1587.188 |
2015-01-06 | 1506.375 |
2015-01-07 | 1477.604 |
2015-01-08 | 1493.302 |
2015-01-09 | 1520.146 |
2015-01-10 | 1834.219 |
2015-01-11 | 1797.198 |
2015-01-12 | 1749.708 |
2015-01-13 | 1666.719 |
2015-01-14 | 1630.625 |
2015-01-15 | 1651.906 |
2015-01-16 | 1632.135 |
2015-01-17 | 1647.198 |
2015-01-18 | 1607.688 |
2015-01-19 | 1627.823 |
2015-01-20 | 1716.552 |
2015-01-21 | 1752.917 |
2015-01-22 | 1698.396 |
2015-01-23 | 1642.250 |
2015-01-24 | 1536.698 |
2015-01-25 | 1388.698 |
2015-01-26 | 1375.635 |
2015-01-27 | 1453.750 |
2015-01-28 | 1459.240 |
2015-01-29 | 1483.333 |
2015-01-30 | 1581.062 |
⋮ | ⋮ |
2021-05-01 | 1746.969 |
2021-05-02 | 1842.750 |
2021-05-03 | 1841.500 |
2021-05-04 | 1733.823 |
2021-05-05 | 1767.896 |
2021-05-06 | 1917.021 |
2021-05-07 | 1931.146 |
2021-05-08 | 1826.156 |
2021-05-09 | 1583.917 |
2021-05-10 | 1817.938 |
2021-05-11 | 2202.385 |
2021-05-12 | 2322.167 |
2021-05-13 | 2352.062 |
2021-05-14 | 2277.323 |
2021-05-15 | 2200.688 |
2021-05-16 | 2014.333 |
2021-05-17 | 2169.760 |
2021-05-18 | 2234.156 |
2021-05-19 | 2207.667 |
2021-05-20 | 2212.958 |
2021-05-21 | 1997.812 |
2021-05-22 | 1814.167 |
2021-05-23 | 2015.958 |
2021-05-24 | 2045.812 |
2021-05-25 | 2265.625 |
2021-05-26 | 2267.792 |
2021-05-27 | 2249.958 |
2021-05-28 | 2305.885 |
2021-05-29 | 2152.240 |
2021-05-30 | 1950.156 |
tData_long <- training_data %>%
gather(key = "variable", value = "value", -Time, -year,- Ende)
head(tData_long)
Time | Ende | year | variable | value |
---|---|---|---|---|
<chr> | <time> | <date> | <chr> | <dbl> |
2015-01-01_00:00:00 | 01:00:00 | 2015-01-01 | Biomasse | 4024.25 |
2015-01-01_01:00:00 | 02:00:00 | 2015-01-01 | Biomasse | 3982.75 |
2015-01-01_02:00:00 | 03:00:00 | 2015-01-01 | Biomasse | 4019.50 |
2015-01-01_03:00:00 | 04:00:00 | 2015-01-01 | Biomasse | 4040.75 |
2015-01-01_04:00:00 | 05:00:00 | 2015-01-01 | Biomasse | 4037.75 |
2015-01-01_05:00:00 | 06:00:00 | 2015-01-01 | Biomasse | 4028.25 |
tail(tData_long)
Time | Ende | year | variable | value |
---|---|---|---|---|
<chr> | <time> | <date> | <chr> | <dbl> |
2021-05-30_18:00:00 | 19:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1369.50 |
2021-05-30_19:00:00 | 20:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1350.50 |
2021-05-30_20:00:00 | 21:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1339.00 |
2021-05-30_21:00:00 | 22:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1356.50 |
2021-05-30_22:00:00 | 23:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1355.75 |
2021-05-30_23:00:00 | 00:00:00 | 2021-05-30 | Sonstige_Konventionelle | 1355.75 |
summary_df <- tData_long %>%
group_by(year,variable) %>%
summarize(Total_Value = sum(value))
head(summary_df)
`summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
year | variable | Total_Value |
---|---|---|
<date> | <chr> | <dbl> |
2015-01-01 | Biomasse | 96341.25 |
2015-01-01 | Braunkohle | 314599.00 |
2015-01-01 | Erdgas | 23806.00 |
2015-01-01 | Kernenergie | 251485.25 |
2015-01-01 | Photovoltaik | 17080.25 |
2015-01-01 | Pumpspeicher | 23683.50 |
summary_df %>%
ggplot( aes(x=year, y=Total_Value, group=variable, color=variable)) +
geom_point()
tData_long %>%
ggplot( aes(x=year, y=value, group=variable, color=variable)) +
geom_point()
tData_longSum=summarise(tData_long, variable_name=year)
Warning message: “Returning more (or less) than 1 row per `summarise()` group was deprecated in dplyr 1.1.0. ℹ Please use `reframe()` instead. ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()` always returns an ungrouped data frame and adjust accordingly.”
tData_long_sum = aggregate(tData_long$value, by=list(tData_long$year), sum)
tData_long_sum
Group.1 | x |
---|---|
<date> | <dbl> |
2015-01-01 | 1262749 |
2015-01-02 | 1499551 |
2015-01-03 | 1405097 |
2015-01-04 | 1320111 |
2015-01-05 | 1509716 |
2015-01-06 | 1512748 |
2015-01-07 | 1647952 |
2015-01-08 | 1730101 |
2015-01-09 | 1730532 |
2015-01-10 | 1511796 |
2015-01-11 | 1440382 |
2015-01-12 | 1568389 |
2015-01-13 | 1578018 |
2015-01-14 | 1539344 |
2015-01-15 | 1737290 |
2015-01-16 | 1619432 |
2015-01-17 | 1446805 |
2015-01-18 | 1408074 |
2015-01-19 | 1550405 |
2015-01-20 | 1588490 |
2015-01-21 | 1614505 |
2015-01-22 | 1623537 |
2015-01-23 | 1574030 |
2015-01-24 | 1497368 |
2015-01-25 | 1404334 |
2015-01-26 | 1678994 |
2015-01-27 | 1708761 |
2015-01-28 | 1758790 |
2015-01-29 | 1734302 |
2015-01-30 | 1571701 |
⋮ | ⋮ |
2021-05-01 | 1005633.2 |
2021-05-02 | 1145334.5 |
2021-05-03 | 1366224.2 |
2021-05-04 | 1682637.2 |
2021-05-05 | 1642942.8 |
2021-05-06 | 1417251.0 |
2021-05-07 | 1420219.2 |
2021-05-08 | 1207325.2 |
2021-05-09 | 1284934.5 |
2021-05-10 | 1324527.2 |
2021-05-11 | 1222800.0 |
2021-05-12 | 1176296.5 |
2021-05-13 | 945800.8 |
2021-05-14 | 1039090.8 |
2021-05-15 | 1022135.2 |
2021-05-16 | 1019434.8 |
2021-05-17 | 1174479.0 |
2021-05-18 | 1212419.8 |
2021-05-19 | 1207679.0 |
2021-05-20 | 1233783.8 |
2021-05-21 | 1436713.2 |
2021-05-22 | 1465029.8 |
2021-05-23 | 1209283.8 |
2021-05-24 | 1239453.0 |
2021-05-25 | 1429122.8 |
2021-05-26 | 1484295.8 |
2021-05-27 | 1502677.5 |
2021-05-28 | 1319048.5 |
2021-05-29 | 1142207.5 |
2021-05-30 | 1077126.8 |