R/getGapStrategyBestParamByScore.R

Defines functions getGapStrategyBestParamByScore

getGapStrategyBestParamByScore <- function(dbcon_str, side = "Long",
                                           last_only = FALSE) {

  si_de <- side
  best_params <- getGapStrategyResults(dbcon_str) %>%
    dplyr::filter(side == si_de) %>%
    dplyr::group_by(range) %>%
    dplyr::filter(score == max(score)) %>%
    dplyr::distinct(range, .keep_all = TRUE) %>% 
    dplyr::arrange(range) %>%
    data.table::data.table()

  if (last_only) {
    result <- best_params[nrow(best_params)]
  } else {
    result <- best_params
  }

  return (result)
}
tmk-c/myrlib documentation built on May 29, 2019, 1:44 p.m.