Skip to contents

This documentation is for developers of poppr. The accessors here are preferred over accessing the elements via the @ symbol. Please use these in your code when accessing MLG objects.

Usage

visible(x)

visible(x) <- value

MLG2df(x)

distname(x)

distenv(x)

distname(x) <- value

distenv(x) <- value

distargs(x)

distargs(x) <- value

distalgo(x)

distalgo(x) <- value

cutoff(x)

cutoff(x) <- value

Arguments

x

an MLG object

value

see details

Value

see details

Details

These accessors are intended for internal use only. They only affect MLG objects, not genind objects. Only visible and MLG2df are general for all forms of MLG. The distargs and cutoff are specific for use in mlg.filter or any function that offers filtering as an option. The argument "value" will always take the type defined in the MLG class.

Examples


# \dontrun{
# These examples will simply show you what you can do with these
set.seed(5000)
(x <- sample(10, 20, replace = TRUE))
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2
(m <- new("MLG", x))
#> 20 original mlgs.
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2

# Visibility ------------------------------
visible(m) # original
#> [1] "original"
visible(m) <- "contracted"
m          # shows contracted MLGS
#> 20 contracted mlgs with a cutoff of 0 based on the function diss.dist
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2

# Conversion to data frame ----------------
MLG2df(m)  # Grab the internal data frame
#>    expanded original contracted custom
#> 1         8        8          8      8
#> 2         5        5          5      5
#> 3         5        5          5      5
#> 4         2        2          2      2
#> 5         3        3          3      3
#> 6         1        1          1      1
#> 7         4        4          4      4
#> 8         9        9          9      9
#> 9         6        6          6      6
#> 10        4        4          4      4
#> 11        5        5          5      5
#> 12        9        9          9      9
#> 13        7        7          7      7
#> 14       10       10         10     10
#> 15        2        2          2      2
#> 16        4        4          4      4
#> 17        2        2          2      2
#> 18        4        4          4      4
#> 19       10       10         10     10
#> 20        2        2          2      2

# Distance function handling --------------
distname(m) # nei.dist
#> [1] "diss.dist"
distargs(m) # list()
#> list()
distalgo(m) # farthest
#> [1] "farthest_neighbor"
cutoff(m)
#>   expanded contracted 
#>          0          0 

distname(m) <- substitute("diss.dist")
distargs(m) <- list(percent = TRUE)
distalgo(m) <- "average"
cutoff(m)["contracted"] <- 0.2

# }