Skip to contents

Half-sib pairs are counted between samples grouped by birth year and sampled location.

Usage

as_hsp(samples)

write_hsp(x, path = "hsp.txt")

read_hsp(path)

Arguments

samples

A sample_family data.frame of tekka() result.

x

An outcome of as_hsp()

path

A file name or connection to write to

Value

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

  • cohort_i, cohort_j: birth year of samples

  • location_i, location_j: of sampling

  • comps: the number of possible comparisons between group i and j. All samples are compared pairwise, excluding self-comparisons. The total number of comparisons equals \(n \choose 2\), where n is the total sample size.

  • hsps: the count of half-sib pairs observed between group i and j

Details

as_hsp() converts a result data frame to HSP format.

write_hsp() writes a HSP data.frame to a file.

See also

as_hsp2() for the extended HSP format.

Examples

set.seed(666)
result = tekka("-y20 -l2 --sa 2,2 --sj 2,2")
samples = result$sample_family[[1L]]
as_hsp(samples)
#> # A tibble: 55 × 6
#>    cohort_i cohort_j location_i location_j comps  hsps
#>       <int>    <int>      <int>      <int> <int> <int>
#>  1       11       11          1          1     1     1
#>  2       15       15          0          1     1     1
#>  3       19       19          0          0     1     1
#>  4        9        9          1          1     0     0
#>  5        9       11          1          1     2     0
#>  6        9       14          1          0     1     0
#>  7        9       15          1          0     1     0
#>  8        9       15          1          1     1     0
#>  9        9       16          1          0     2     0
#> 10        9       19          1          0     2     0
#> # ℹ 45 more rows