R/easy_fun.R

Defines functions dt_to_char comb_char fill_na

#' @import lubridate
##date translate to char
dt_to_char <- function(x)
{
  if(is.null(x))
  {
    return(x)
  }
  return(format(ymd(x),'%Y%m%d'))
}

##combine char list
comb_char <- function(x)
{
  paste0("'",x,"'", collapse = ',')
}

fill_na <- function(x, fill = 0)
{
  ifelse(is.na(x), fill, x)
}
cloud-brain/backtest documentation built on Feb. 6, 2020, 11:17 p.m.