These are the tanh scaled weights, and not the relative preferences.
# load libs library(data.table) library(stringr) # load local functions in `R/` 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+)"))] # select the default scenario with regrowth == 0.01 data = data[regrowth == 0.01,]
Get frequencies of evolved cue preferences using the custom function get_sim_weight_evol
, documented in R/fun_weight_evo.R
# from each simulation temp_gen_data <- lapply( data$path, function(x) { # this applies a custom function to each simulation replicate get_sim_weight_evol( data_folder = x, generations = unique( c( seq(1, 999, 2) ) ), which_weight = NA ) } ) # bind with parameters data[, wt_data := temp_gen_data] # unnest data <- data[, unlist(wt_data, recursive = F), by = list(sim_type, rep, regrowth) ] fwrite(data, file = "data/results/data_relative_preference_evolution.csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.