Skip to contents

Extract an element from iamOutput-class and format this as a tibble. This tibble is 6 column wide with specified format (see details)

Usage

IAM.format(object, name, sim_name = NA_character_, n = NA_real_)

# S4 method for iamOutput,character
IAM.format(object, name, sim_name = NA_character_, n = NA_real_)

format_vareco(object, name, sim_name = NA_character_, n = NA_real_)

format_varsp(object, name, sim_name = NA_character_, n = NA_real_)

Arguments

object

iamOutput-class object created with IAM.model().

name

names of the exported variable from IAM. "summary" will select few variables that are usually displayed for most common scenarii ("Fbar", "SSB", "L_et", "N", "nbv_f", "effort2_f", "GVLav_f", "gva_f", "gp_f", "wageg_f", "wagen_f"). chr.

sim_name

Name of the simulation, used for joining multiple scenarii iamOutput. NA by default, chr.

n

Number of the simulation, used for joining replicated iamOutput. NA by default, dbl.

Value

Format : long format for ggplot and dplyr analysis to facilitate filter and summary computations. If the variable is not defined for a specific dimension (column), this column is filled with NA.

sim_name

Simulation name. chr.

n

Number of the simulation. dbl

variable

Single value repeated, but is needed if multiple variables are assembled with bind_row(). chr vector

species

Species names, can contain dynamic and static species depending on the variable selected.. chr vector

fleet

Fleet names. fct vector

metier

Metier names. fct vector

age

Ages for dynamic species. fct vector

year

year step for the simulation. dbl vector

value

Value of the variable for every column place indicated on the same row. dbl vector

Details

The reconcilSPP variable return character value, so it can't be binded with other variable which are numeric.

Author

Maxime Jaunatre

Examples

data("IAM_input_2009")
data("IAM_argum_2009")
sim_statu_quo <- IAM::IAM.model(objArgs = IAM_argum_2009, objInput = IAM_input_2009)

#' cas vide return NULL
IAM.format(sim_statu_quo, "not a variable")
#> Warning: "not a variable" variable does not exist in an IAM output.
#> NULL
#' cas simple bio
IAM.format(sim_statu_quo, "SSB")
#> # A tibble: 36 × 9
#>    sim_name     n variable species fleet metier age    year  value
#>    <chr>    <dbl> <chr>    <chr>   <chr> <chr>  <chr> <dbl>  <dbl>
#>  1 NA          NA SSB      ARC     NA    NA     NA     2009 18723.
#>  2 NA          NA SSB      ARC     NA    NA     NA     2010 17990.
#>  3 NA          NA SSB      ARC     NA    NA     NA     2011 17220.
#>  4 NA          NA SSB      ARC     NA    NA     NA     2012 16459.
#>  5 NA          NA SSB      ARC     NA    NA     NA     2013 16194.
#>  6 NA          NA SSB      ARC     NA    NA     NA     2014 16611.
#>  7 NA          NA SSB      ARC     NA    NA     NA     2015 17817.
#>  8 NA          NA SSB      ARC     NA    NA     NA     2016 19506.
#>  9 NA          NA SSB      ARC     NA    NA     NA     2017 21242.
#> 10 NA          NA SSB      ARC     NA    NA     NA     2018 22793.
#> # … with 26 more rows
#' cas complexe bio
IAM.format(sim_statu_quo, "F")
#> # A tibble: 40,656 × 9
#>    sim_name     n variable species fleet           metier    age    year value
#>    <chr>    <dbl> <chr>    <chr>   <fct>           <fct>     <fct> <dbl> <dbl>
#>  1 NA          NA F        ARC     Alis            Filet_DAR 0      2009     0
#>  2 NA          NA F        ARC     Antea           Filet_DAR 0      2009     0
#>  3 NA          NA F        ARC     Atalante        Filet_DAR 0      2009     0
#>  4 NA          NA F        ARC     Haliotis        Filet_DAR 0      2009     0
#>  5 NA          NA F        ARC     Marion_Dufresne Filet_DAR 0      2009     0
#>  6 NA          NA F        ARC     Pourquoi_pas    Filet_DAR 0      2009     0
#>  7 NA          NA F        ARC     Thalassa        Filet_DAR 0      2009     0
#>  8 NA          NA F        ARC     Alis            Filet_DP  0      2009     0
#>  9 NA          NA F        ARC     Antea           Filet_DP  0      2009     0
#> 10 NA          NA F        ARC     Atalante        Filet_DP  0      2009     0
#> # … with 40,646 more rows
IAM.format(sim_statu_quo, "N_S1M1")
#> # A tibble: 192 × 9
#>    sim_name     n variable species fleet metier age    year   value
#>    <chr>    <dbl> <chr>    <chr>   <chr> <chr>  <fct> <dbl>   <dbl>
#>  1 NA          NA N_S1M1   DAR     NA    NA     0      2009 137653 
#>  2 NA          NA N_S1M1   DAR     NA    NA     1      2009  50556.
#>  3 NA          NA N_S1M1   DAR     NA    NA     2      2009  21313.
#>  4 NA          NA N_S1M1   DAR     NA    NA     3      2009  25389 
#>  5 NA          NA N_S1M1   DAR     NA    NA     4      2009  15481.
#>  6 NA          NA N_S1M1   DAR     NA    NA     5      2009   2399.
#>  7 NA          NA N_S1M1   DAR     NA    NA     6      2009    875.
#>  8 NA          NA N_S1M1   DAR     NA    NA     7      2009    624.
#>  9 NA          NA N_S1M1   DAR     NA    NA     8      2009    731.
#> 10 NA          NA N_S1M1   DAR     NA    NA     9      2009    119.
#> # … with 182 more rows
#' cat eco
IAM.format(sim_statu_quo, name = "ratio_gp_K_f")
#> # A tibble: 84 × 9
#>    sim_name     n variable     species fleet metier age    year  value
#>    <chr>    <dbl> <chr>        <lgl>   <chr> <chr>  <chr> <dbl>  <dbl>
#>  1 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2009 -0.899
#>  2 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2010 -0.899
#>  3 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2011 -0.899
#>  4 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2012 -0.899
#>  5 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2013 -0.899
#>  6 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2014 -0.899
#>  7 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2015 -0.899
#>  8 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2016 -0.899
#>  9 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2017 -0.899
#> 10 NA          NA ratio_gp_K_f NA      Alis  NA     NA     2018 -0.899
#> # … with 74 more rows
#' Warning here values are string !
IAM.format(sim_statu_quo, name = "reconcilSPP")
#> Warning: reconcilSPP variable has character for value. This will cause problems if you need to rbind ouputs of IAM.format()
#> # A tibble: 924 × 9
#>    sim_name     n variable    species fleet           metier   age    year value
#>    <chr>    <dbl> <chr>       <lgl>   <fct>           <fct>    <chr> <dbl> <chr>
#>  1 NA          NA reconcilSPP NA      Alis            Filet_D… NA        1 NA   
#>  2 NA          NA reconcilSPP NA      Antea           Filet_D… NA        1 NA   
#>  3 NA          NA reconcilSPP NA      Atalante        Filet_D… NA        1 NA   
#>  4 NA          NA reconcilSPP NA      Haliotis        Filet_D… NA        1 NA   
#>  5 NA          NA reconcilSPP NA      Marion_Dufresne Filet_D… NA        1 NA   
#>  6 NA          NA reconcilSPP NA      Pourquoi_pas    Filet_D… NA        1 NA   
#>  7 NA          NA reconcilSPP NA      Thalassa        Filet_D… NA        1 NA   
#>  8 NA          NA reconcilSPP NA      Alis            Filet_DP NA        1 NA   
#>  9 NA          NA reconcilSPP NA      Antea           Filet_DP NA        1 NA   
#> 10 NA          NA reconcilSPP NA      Atalante        Filet_DP NA        1 NA   
#> # … with 914 more rows