findHorizon: Analyse the booking horizon

Description Usage Arguments Details Value Examples

View source: R/bookMatrix.R

Description

Reshaping the data to find the booking horizon

Usage

1
findHorizon(hotelData, ...)

Arguments

hotelData

a data.frame with the variables of the booking date, the arrival date and the date of departure.

...

arguments to be used to form the default control argument if it is not supplied directly.

Details

findHorizon fits the booking horizon of the provided data.frame.

Value

An object of class "data.frame".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##  create sample
date_from <- sort(as.Date(runif(20000, min=1, max=700),origin = "2015-01-01"))
date_creation <- round(runif(20000, min = 1, max = 365), digits = 0) 
date_to <- round(rnorm(20000, mean = 2, sd = 1), digits = 0)    
hotelData2 <- data.frame(date_creation, date_from, date_to)
hotelData2$date_to <- as.Date(hotelData2$date_from + hotelData2$date_to)
hotelData2$date_creation <- as.Date(hotelData2$date_from - hotelData2$date_creation)
hotelData2 <- data.frame(subset(hotelData2, hotelData2$date_to >= hotelData2$date_from & hotelData2$date_from >= hotelData2$date_creation))
rownames(hotelData2) <- seq(length(hotelData2$date_creation),from = 1)
rm(date_creation, date_from, date_to)

## use function with sample hotelData2
horizon1 <- findHorizon(hotelData = hotelData2)

bookMatrix documentation built on May 2, 2019, 5:46 p.m.