knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(qp4ewc)

Aim

In this vignette, you will get more information about how to get an overview of all the scenario produced.

Parameters

#Path to file
path_results_files <- system.file("extdata","ewbc","Ecoweight_output", package = "qp4ewc")
# Name of results file from ewbc
s_results_name <- "test"
# Path to output statements from the results file of ewbc
s_output_statement <-  system.file("extdata","ewbc","output_statement.txt", package = "qp4ewc")
# Path to search patterns needed to find correct results 
s_output_search_pattern <- system.file("extdata","ewbc","output_searchpattern.txt", package = "qp4ewc")
# Path to define from the working directory for beef-on-dairy
s_path_directory2create <- file.path(here::here(),"inst","extdata","ewbc","test","Ecoweight_output")
# Path to save table of result 
s_path_extracted_results <- file.path(here::here(),"inst", "extdata", "ewbc", "results")
# Path to genetic standard deviation values 
s_input_genetic_SD <- system.file("extdata","ewbc","input_geneticSD.txt", package = "qp4ewc")
# Flag to set to TRUE, if a log-file is whished
b_log <- TRUE
# Filenames
filenames <- c("AN_KR_3_Natura-Beef_test",
               "AU_AU_1_Natura-Beef_test",
               "CH_KR_3_Natura-Beef_test",
               "LM_LM_1_Natura-Beef_test",
               "OB_KR_3_Natura-Beef_test",
               "SI_SI_1_Natura-Beef_test")

Produce result files (csv and pdf) for each scenario

for(idx in 1:length(filenames)){
  s_scenario <- filenames[idx]
  scenario_split <- unlist(strsplit(s_scenario, split = "_", fixed = TRUE))
  s_sirebreed <- scenario_split[1]
  s_dambreed <- scenario_split[2]
  s_prodsystew <- scenario_split[3]
  s_marketingchannel <- scenario_split[4]
  post_process_output(ps_path_2outputfile = path_results_files,
                      ps_outputfilenameECOWEIGHT = s_results_name,
                      ps_output_statement = s_output_statement,
                      ps_output_search_pattern = s_output_search_pattern,
                      ps_sirebreed = s_sirebreed,
                      ps_dambreed = s_dambreed,
                      ps_prodsystem = s_prodsystew,
                      ps_marketchannel = s_marketingchannel,
                      ps_path_directory2create = s_path_directory2create,
                      ps_scenario = s_scenario,
                      ps_path_tbl_save = s_path_extracted_results,
                      ps_input_genetic_SD = s_input_genetic_SD,
                      pb_log = b_log)
}

Sort the scenario by a criterium and produce a table in a pdf

sort by sire:

s_sort_by = "sire_breed"
create_table_results_ewbc(ps_sort_by = s_sort_by,
                          ps_path_results_tbl = s_path_extracted_results,
                          ps_path_save = s_path_extracted_results,
                          pb_log = b_log)

sort by dam:

s_sort_by = "dam_breed"
create_table_results_ewbc(ps_sort_by = s_sort_by,
                         ps_path_results_tbl = s_path_extracted_results,
                         ps_path_save = s_path_extracted_results,
                         pb_log = b_log)

sort by marketing channel

s_sort_by = "production_system"
create_table_results_ewbc(ps_sort_by = s_sort_by,
                          ps_path_results_tbl = s_path_extracted_results,
                          ps_path_save = s_path_extracted_results,
                          pb_log = b_log)

Have a look under s_path_extracted_results.



sknqualitasag/qp4ewc documentation built on Sept. 27, 2022, 3:31 p.m.