R/convert_datetime_into_date.R

Defines functions convert_datetime_into_date

Documented in convert_datetime_into_date

#' Convert date-time into date
#' 
#' @param dateTime A character vector of date-times in [DD/MM/YYYY HH:MM] form.
#' @return A cleaned character vector with [HH:MM] stripped from [DD/MM/YYYY HH:MM].
#' @author Alexander Kheirallah ([email protected])
#' @export 

convert_datetime_into_date = function(dateTime){
  o = unlist(strsplit(dateTime, split = " "))
  o = o[seq(1,length(o),by=2)]
  o = as.Date(o, "%d/%m/%Y")
  return(o)
}
msxakk89/dat documentation built on April 3, 2020, 5:39 p.m.