Skip to contents

Make a data set of all possible pairwise substitution of a composition which can be used as the base for substitution models.

Usage

basesub(parts)

Arguments

parts

A character vector specifying the names of compositional variables to be used.

Value

A data table of all possible pairwise substitution.

Examples

ps1 <- basesub(parts = c("TST", "WAKE", "MVPA", "LPA", "SB"))
print(ps1)
#>       TST  WAKE  MVPA   LPA    SB
#>     <num> <num> <num> <num> <num>
#>  1:     1    -1     0     0     0
#>  2:     1     0    -1     0     0
#>  3:     1     0     0    -1     0
#>  4:     1     0     0     0    -1
#>  5:    -1     1     0     0     0
#>  6:     0     1    -1     0     0
#>  7:     0     1     0    -1     0
#>  8:     0     1     0     0    -1
#>  9:    -1     0     1     0     0
#> 10:     0    -1     1     0     0
#> 11:     0     0     1    -1     0
#> 12:     0     0     1     0    -1
#> 13:    -1     0     0     1     0
#> 14:     0    -1     0     1     0
#> 15:     0     0    -1     1     0
#> 16:     0     0     0     1    -1
#> 17:    -1     0     0     0     1
#> 18:     0    -1     0     0     1
#> 19:     0     0    -1     0     1
#> 20:     0     0     0    -1     1
#>       TST  WAKE  MVPA   LPA    SB

ps2 <- basesub(c("WAKE", "MVPA", "LPA", "SB"))
print(ps2)
#>      WAKE  MVPA   LPA    SB
#>     <num> <num> <num> <num>
#>  1:     1    -1     0     0
#>  2:     1     0    -1     0
#>  3:     1     0     0    -1
#>  4:    -1     1     0     0
#>  5:     0     1    -1     0
#>  6:     0     1     0    -1
#>  7:    -1     0     1     0
#>  8:     0    -1     1     0
#>  9:     0     0     1    -1
#> 10:    -1     0     0     1
#> 11:     0    -1     0     1
#> 12:     0     0    -1     1