A result is first written to a directory in cache
,
and then read into a data.frame.
If a previous result with exactly the same arguments is found in cache
,
it is read without calling tekka
.
Usage
tekka(args = character(0L), cache = NULL)
Arguments
- args
Command line arguments as a string vector. See
tekka
manual andtekka("--help")
for available options. Note that a random--seed
is appended if not given. Useset.seed()
or--seed
explicitly for reproducibility and caching.- cache
Parent directory for tekka output.
TRUE
is equivalent to "." (current directory).tempdir()
is used in other cases including the default (NULL
), which is discarded at the end of an R session. SetFALSE
to forcetekka
to run and overwrite previous results if any.
Value
A data.frame read by read_tekka()
.
See also
tekka_path()
to get information about the tekka
installation.
Examples
set.seed(666)
# tekka("--help")
result = tekka("-y20 -l2 --sa 2,2 --sj 2,2")
result |> dplyr::select(!"outdir")
#> # A tibble: 1 × 16
#> carrying_capacity fishing_coef fishing_mortality last migration_matrices
#> <dbl> <list> <list> <int> <list>
#> 1 2000 <list [0]> <dbl [84]> 2 <dbl [9 × 4 × 4]>
#> # ℹ 11 more variables: natural_mortality <list>, origin <int>,
#> # overdispersion <dbl>, recruitment <dbl>, sample_size_adult <list>,
#> # sample_size_juvenile <list>, seed <int>, weight_for_age <list>,
#> # years <int>, sample_family <list>, demography <list>
result$sample_family[[1L]]
#> # A tibble: 96 × 6
#> id father_id mother_id birth_year location capture_year
#> <int> <int> <int> <int> <int> <int>
#> 1 20 0 0 -4 NA NA
#> 2 19 20 20 0 NA NA
#> 3 21 20 20 0 NA NA
#> 4 18 19 21 5 NA NA
#> 5 23 20 20 0 NA NA
#> 6 22 19 23 4 NA NA
#> 7 17 18 22 11 NA NA
#> 8 26 20 20 0 NA NA
#> 9 27 20 20 0 NA NA
#> 10 25 26 27 5 NA NA
#> # ℹ 86 more rows
result$demography[[1L]]
#> # A tibble: 827 × 5
#> year season location age count
#> <int> <int> <int> <int> <int>
#> 1 0 0 0 0 2000
#> 2 0 1 0 0 1227
#> 3 0 2 0 0 787
#> 4 0 3 0 0 469
#> 5 4 0 0 0 2036
#> 6 4 0 0 4 24
#> 7 4 1 0 0 1250
#> 8 4 1 0 4 20
#> 9 4 2 0 0 801
#> 10 4 2 0 4 19
#> # ℹ 817 more rows