R/data-prep.R

Defines functions prepare_row prepare_dfr prepare_mxinfo prepare_matrix prepare_resvector create_table

prepare_row <- function(.result, .fn_records = RECTIMES) {
  scores <- seq(from = 100, to = 3000, by = 100)
  1:length(.fn_records) %>%
    purrr::map(function(record) {
      abs(.result$result[[1]]$diagnostic$bestVal[.fn_records[record] * ceiling(nrow(.result$result[[1]]$diagnostic$bestVal)), ] - scores[.result$pnum])
    })
}


prepare_dfr <- function(.dfr) {
  results <- list()
  for (row in 1:nrow(.dfr)) {
    results[[row]] <- .dfr[row, ] %>% prepare_row()
  }
  results %>%
    purrr::map(function(result) {
      result %>% purrr::flatten()
    }) %>%
    data.table() %>%
    setNames("resultVec")
}


prepare_mxinfo <- function(.dfr) {
  .dfr %>%
    prepare_dfr() %>%
    dplyr::bind_cols(.dfr)
}


prepare_matrix <- function(.dfr) {
  .dfr
}


prepare_resvector <- function(.dfr) {
  .dfr
}

create_table <- function() {

}
warbarbye/cecs-benchmark documentation built on March 10, 2020, 12:09 a.m.