# load libraries library(data.table) library(stringr) # some helper functions devtools::load_all()
Prepare data paths.
# read paths paths <- list.dirs("data/", recursive = F) paths <- paths[grep("rep_", paths)] # make df data = CJ( path = paths ) # get replicate data[, rep := as.numeric( stringr::str_extract_all(path, "rep_(\\d{3})") |> stringr::str_extract_all("\\d{3}") )] # get sim type data[, sim_type := stringr::str_extract( path, "obligate|facultative|foragers|random" ) ] data[, regrowth := as.numeric(str_extract(path, "(0\\.\\d+)"))]
Get the population's evolved activity budget over evolutionary time. This is handled by the custom function get_strategy_gen
, documented in R/fun_get_strategy_gen.R
.
# get strategy, fitness and conflicts over gens data[, summary_data := lapply( path, # use the function get_strategy_gen, documented in get_strategy_gen )]
Combine the data for simulation replicates, scenarios, and parameter combinations.
# unlist data <- data[, unlist(summary_data, recursive = F), by = c("sim_type", "rep", "regrowth") ]
Save combined data.
# save data fwrite(data, file = "data/results/data_pop_activity_budget.csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.