R/extract_date_params.R

Defines functions extract_date_params

Documented in extract_date_params

#' a function for extracting date parameters
#'
#' ADD TEST DATE INFORMATION.  ALSO ADD TEST TIME
#'
#' @param komp.data The input data
#' @param list The list
#' @param stdv The stdv
#'
#' @return dt.final The outlier-removed data
#'
#' @examples
#' OFA <- ExtractDateParameters(OFA, 'OFA')
#' @export
#'

extract_date_params <- function (DataSet, DataName) {
  DateColumnNumber <- which(colnames(DataSet)=="Date.of.test.New")
  DateColumn <- DataSet[,DateColumnNumber]
  Year <- as.factor(year(DateColumn))
  Month <- month(DateColumn, label = TRUE)
  DayOfWeek <- wday(DateColumn, label = TRUE)
  DayOfYear <- yday(DateColumn)
  DayOfMonth <- mday(DateColumn)
  DataSet <- cbind(DataSet, Year, Month, DayOfWeek, DayOfYear, DayOfMonth)
  return(DataSet)
}
dleelab/KompUtils documentation built on May 13, 2017, 3:31 a.m.