I'm a beginner learner in R and my data is the data of a hotel with 3 different apartments and its bookings between 2018 and 2022. For each booking I have an arrival date and a departure date (already in the date format), the total nights booked and which apartment they stayed in. I now want to analyze and plot the data to see how the number of bookings have changed over time overall and for each of the different apartments. I would really like to get a graph that looks like a geom_line graph in ggplot, but I can't figure out the best way to do this, and how to put the "number of bookings" into a variable.
Thank you!
This is the head of my data:
arr_date dep_date total_nights hochsaison mittelsaison nebensaison ost west sued ost.west sued.west sued.ost gesamtes_haus year month wday
1 2018-01-12 2018-01-14 2 0 0 2 0 0 0 0 0 2 0 2018 Jan Fr
2 2018-01-17 2018-01-21 4 0 0 4 0 4 0 0 0 0 0 2018 Jan Mi
3 2018-01-21 2018-01-24 3 0 0 3 0 0 3 0 0 0 0 2018 Jan So
4 2018-02-09 2018-02-11 2 0 2 0 0 0 0 2 0 0 0 2018 Feb Fr
5 2018-02-09 2018-02-13 4 0 4 0 0 0 4 0 0 0 0 2018 Feb Fr
6 2018-02-16 2018-02-18 2 0 0 2 0 0 0 0 0 0 2 2018 Feb Fr
Rows: 323
Columns: 16
$ arr_date <date> 2018-01-12, 2018-01-17, 2018-01-21, 2018-02-09, 2018-02-09, 2018-02-16, 2018-02-23, 2018-02-22, 2018-03-19, 2018-03-27, 2018-03-29, 2018-04-19, 2018-04-27, 201…
$ dep_date <date> 2018-01-14, 2018-01-21, 2018-01-24, 2018-02-11, 2018-02-13, 2018-02-18, 2018-02-25, 2018-02-25, 2018-03-24, 2018-04-03, 2018-04-04, 2018-04-24, 2018-05-01, 201…
$ total_nights <dbl> 2, 4, 3, 2, 4, 2, 2, 3, 5, 7, 5, 5, 4, 3, 6, 5, 17, 7, 7, 15, 13, 9, 19, 7, 7, 14, 8, 13, 10, 11, 6, 7, 14, 6, 5, 5, 13, 7, 7, 10, 3, 6, 5, 7, 12, 12, 12, 2, 2,…
$ hochsaison <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 0, 3, 3, 6, 5, 17, 7, 7, 15, 13,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ sued.west <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
$ sued.ost <dbl> 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0…
$ gesamtes_haus <dbl> 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 4, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0…
$ year <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018…
$ month <chr> "Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Feb", "Feb", "Mär", "Mär", "Mär", "Apr", "Apr", "Mai", "Mai", "Jun", "Jun", "Jun", "Jun", "Jul", "Jul", "Jul", "Jul",…
$ wday <chr> "Fr", "Mi", "So", "Fr", "Fr", "Fr", "Fr", "Do", "Mo", "Di", "Do", "Do", "Fr", "Fr", "Sa", "Fr", "Do", "Sa", "Sa", "Sa", "So", "Do", "So", "Sa", "Sa", "Sa", "Sa"…
>
structure(list(arr_date = structure(c(17543, 17548, 17552, 17571,
17571, 17578), class = "Date"), dep_date = structure(c(17545,
17552, 17555, 17573, 17575, 17580), class = "Date"), total_nights = c(2,
4, 3, 2, 4, 2), hochsaison = c(0, 0, 0, 0, 0, 0), mittelsaison = c(0,
0, 0, 2, 4, 0), nebensaison = c(2, 4, 3, 0, 0, 2), ost = c(0,
0, 0, 0, 0, 0), west = c(0, 4, 0, 0, 0, 0), sued = c(0, 0, 3,
0, 4, 0), ost.west = c(0, 0, 0, 2, 0, 0), sued.west = c(0, 0,
0, 0, 0, 0), sued.ost = c(2, 0, 0, 0, 0, 0), gesamtes_haus = c(0,
0, 0, 0, 0, 2), year = c(2018, 2018, 2018, 2018, 2018, 2018),
month = c("Jan", "Jan", "Jan", "Feb", "Feb", "Feb"), wday = c("Fr",
"Mi", "So", "Fr", "Fr", "Fr"), wohnung = c("kombi", "west",
"sued", "kombi", "sued", "gesamtes haus"), saison = c("nebensaison",
"nebensaison", "nebensaison", "mittelsaison", "mittelsaison",
"nebensaison")), row.names = c(NA, 6L), class = "data.frame")