Learn R Programming

poppr (version 2.6.1)

MLG-class: MLG class

Description

A class to store multilocus genotypes in genclone objects. This is intended for internal use only.

Arguments

Slots

mlg

a list containing four vectors, one for each type of MLG manipulation.

visible

a character specifying which MLG type is to be displayed and accessed.

distname

the name of the distance function or matrix used to collapse mlgs.

distargs

the arguments provided to compute the distance function.

distalgo

the algorithm used to contract multilocus genotypes.

cutoff

Two numbers specifying the cutoff value for expanding and collapsing MLGs.

See Also

'>genclone '>snpclone mll For developers: visible

Examples

Run this code
# NOT RUN {
# These examples will simply show you what you can do with these
set.seed(5000)
(x <- sample(10, 20, replace = TRUE))
(m <- new("MLG", x))

 visible(m) # original is always default
 
 m[]       # adding braces after the object will always return a vector of 
           # the same type as defined in "visible"
           
 m + 1     # You can do math on the numeric ones
 
 visible(m) <- "custom"
 m + 2     # This should throw a warning
 # The types are stored in a data frame. You can retrieve them easily:
 visible(m) <- "original"
 m
 m[, "custom"]
 
 # Important for subsetting, if you subset the object, normally, it will 
 # return a vector unless you specify all = TRUE
 m[1:10]             # original vector
 m[1:10, all = TRUE] # still class MLG

# }

Run the code above in your browser using DataLab