Maps the data of a data frame on the structure on an object of class experiment.

map_experiment(df, exp)

Arguments

df

A data frame containing variables and parameters values for a number of simulations we wish to use for the experiment exp.

exp

An object of class experiment. See Details for constraints on this object.

Details

The names of the columns of the data frame should correspond to the names of the variables and parameters of the experiment. This can work only if one of the following conditions is met:

  • the sets of names of the data frame and experiment are identical;

  • the names of the data frame are included in the names of the experiment AND the numbers of rows of the data frame and the experiment are identical.

Examples

# First situation: the sets of names of the data frame and the experiment # are exactly the same: if (exists("sir1", inherits = FALSE)) rm(sir1) exp <- sir1 df <- as.data.frame(repl(sir1, 3)) map_experiment(df, exp)
#> Final time step ("tmax") is converted into integer.
#>
#> Seed is converted into integer.
#>
#> Experiment with 3 simulations of 5 parameters and 3 observed variables #> experiment name: sir #> input gaml file: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rama/models/sir.gaml #> model parameters: p_S0, p_I0, p_R0, p_beta, p_gamma #> observed variables: r_S, r_I, r_R #> Experiment overview: #> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 999 1 0 1.5 0.15 1 1 1 1000 1 NA #> 2 999 1 0 1.5 0.15 1 1 1 1000 1 NA #> 3 999 1 0 1.5 0.15 1 1 1 1000 1 NA
# Second situation: the names of the data frame are included in the names of # the experiment AND the numbers of rows of the data frame and the experiment # are equal: exp <- repl(sir1, 3) df <- as.data.frame(exp)[, c(1, 3, 6)] map_experiment(df, exp)
#> Experiment with 3 simulations of 5 parameters and 3 observed variables #> experiment name: sir #> input gaml file: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rama/models/sir.gaml #> model parameters: p_S0, p_I0, p_R0, p_beta, p_gamma #> observed variables: r_S, r_I, r_R #> Experiment overview: #> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 999 1 0 1.5 0.15 1 1 1 1000 1 NA #> 2 999 1 0 1.5 0.15 1 1 1 1000 1 NA #> 3 999 1 0 1.5 0.15 1 1 1 1000 1 NA