601_HW3

Sheng Zhang
2022/1/3

Hotel Bookings

Read in the hotel_bookings dataset from sampledata and view the structure of this dataset

library(dplyr)
hb <- read.csv("D:/601_workspace/hotel_bookings.csv")
dim(hb)
[1] 119390     32
head(hb)
         hotel is_canceled lead_time arrival_date_year
1 Resort Hotel           0       342              2015
2 Resort Hotel           0       737              2015
3 Resort Hotel           0         7              2015
4 Resort Hotel           0        13              2015
5 Resort Hotel           0        14              2015
6 Resort Hotel           0        14              2015
  arrival_date_month arrival_date_week_number
1               July                       27
2               July                       27
3               July                       27
4               July                       27
5               July                       27
6               July                       27
  arrival_date_day_of_month stays_in_weekend_nights
1                         1                       0
2                         1                       0
3                         1                       0
4                         1                       0
5                         1                       0
6                         1                       0
  stays_in_week_nights adults children babies meal country
1                    0      2        0      0   BB     PRT
2                    0      2        0      0   BB     PRT
3                    1      1        0      0   BB     GBR
4                    1      1        0      0   BB     GBR
5                    2      2        0      0   BB     GBR
6                    2      2        0      0   BB     GBR
  market_segment distribution_channel is_repeated_guest
1         Direct               Direct                 0
2         Direct               Direct                 0
3         Direct               Direct                 0
4      Corporate            Corporate                 0
5      Online TA                TA/TO                 0
6      Online TA                TA/TO                 0
  previous_cancellations previous_bookings_not_canceled
1                      0                              0
2                      0                              0
3                      0                              0
4                      0                              0
5                      0                              0
6                      0                              0
  reserved_room_type assigned_room_type booking_changes deposit_type
1                  C                  C               3   No Deposit
2                  C                  C               4   No Deposit
3                  A                  C               0   No Deposit
4                  A                  A               0   No Deposit
5                  A                  A               0   No Deposit
6                  A                  A               0   No Deposit
  agent company days_in_waiting_list customer_type adr
1  NULL    NULL                    0     Transient   0
2  NULL    NULL                    0     Transient   0
3  NULL    NULL                    0     Transient  75
4   304    NULL                    0     Transient  75
5   240    NULL                    0     Transient  98
6   240    NULL                    0     Transient  98
  required_car_parking_spaces total_of_special_requests
1                           0                         0
2                           0                         0
3                           0                         0
4                           0                         0
5                           0                         1
6                           0                         1
  reservation_status reservation_status_date
1          Check-Out              2015-07-01
2          Check-Out              2015-07-01
3          Check-Out              2015-07-02
4          Check-Out              2015-07-02
5          Check-Out              2015-07-03
6          Check-Out              2015-07-03

Relevant research(questions)

We may concerd about how many bookings in 2015 are ordered directly?

hb %>%
  filter(arrival_date_year == 2015 & market_segment == 'Direct') %>%
  dim()
[1] 2314   32