R/norm_ct_data.R

#' Normalizing data
norm_ct_data <- function(df) {
  if (nrow(df) > 0) {
    df %>%
      dplyr::select_(.dots = names(.)[!names(.) %in% c("Flag", "Qty.Unit.Code", "Qty")]) %>%
      tidyr::gather(Variable, Value, Netweight..kg., Trade.Value..US.., na.rm = TRUE) %>%
      dplyr::mutate(Variable = as.factor(Variable)) %>%
      return()
  }
}
EBukin/tradeAnalysis-pack documentation built on May 23, 2019, 8:25 p.m.