Skip to contents

Parent-offspring pairs are counted between potential offspring cohort and potential parents grouped by age, year, and location of sampling. Comparisons are made only between younger and older samples.

Usage

as_pop(samples)

write_pop(x, path = "pop.txt")

read_pop(path)

Arguments

samples

A sample_family data.frame of tekka() result.

x

An outcome of as_pop()

path

A file name or connection to write to

Value

A data.frame with "pop" class and six columns:

  • cohort: birth year of offspring

  • capture_year: of parents

  • capture_age: of parents

  • location: where parents were sampled

  • pops: the count of parent-offspring pairs observed within samples

  • comps: the number of possible comparisons.

Details

as_pop() converts a sample_family data frame to POP format.

write_pop() writes a POP data.frame to a file.

See also

as_pop2() for the extended POP format.

Examples

set.seed(666)
result = tekka("-y20 -l2 --sa 2,2 --sj 2,2")
samples = result$sample_family[[1L]]
as_pop(samples)
#> # A tibble: 30 × 6
#>    cohort capture_year capture_age location  pops comps
#>     <int>        <int>       <int>    <int> <int> <int>
#>  1     19           20           5        1     1     4
#>  2     20           20           9        1     1     4
#>  3     11           19          10        1     0     2
#>  4     14           19           8        1     0     1
#>  5     14           19          10        1     0     1
#>  6     14           20           9        1     0     1
#>  7     15           19           5        0     0     2
#>  8     15           19           8        1     0     2
#>  9     15           19          10        1     0     2
#> 10     15           20           9        1     0     2
#> # ℹ 20 more rows