R/convert_departureDate_plus_otherDate_asWeeksToDeparture.R

Defines functions convert_departureDate_plus_otherDate_asWeeksToDeparture

Documented in convert_departureDate_plus_otherDate_asWeeksToDeparture

#' Convert departure date and other date as weeks to departure
#' 
#' This function converts vectors of departure dates and dates into numeric vector representing weeks to departure.  
#' 
#' @param departureDate A character vector of departure dates. Must be in [DD/MM/YYYY HH:MM] form.
#' @param date A character vector of given dates. Must be in [DD/MM/YYYY HH:MM] form.
#' @return A numeric vector of weeks to departure.
#' @export 

convert_departureDate_plus_otherDate_asWeeksToDeparture = function(departureDate, date){
  departureDate = convert_datetime_into_date(departureDate)
  date = convert_datetime_into_date(date)
  o = as.numeric(departureDate-date)%/%7
  return(o)
}
msxakk89/dat documentation built on Aug. 3, 2020, 6:39 p.m.