pld | R Documentation |
"ploidysuper"
Objects
pld
accesses and replaces the pld
slot of objects of
"ploidysuper"
subclasses. plCollapse
tests
whether an object of one of these classes can be converted to an object
of a simpler one of these classes, and optionally returns the converted
object. These are generic functions with methods for the subclasses of
"ploidysuper"
. These functions are primarily for internal use.
pld(object, samples, loci) pld(object) <- value plCollapse(object, na.rm, returnvalue)
object |
A |
samples |
An optional character or numeric vector indexing the samples for which to return ploidy values. |
loci |
An optional character or numeric vector indexing the loci for which to return ploidy values. |
value |
A numeric vector or matrix that can be coerced to integers. These
represent the ploidies to store in the |
na.rm |
Boolean. If |
returnvalue |
Boolean. If |
pld
returns the vector or matrix containing the ploidy values.
This is the contents of object@pld
.
plCollapse
either returns a Boolean value indicating whether the
ploidy can be changed to a simpler format, or a new "ploidysuper"
object with all of the ploidy data of object
put into a simpler
format. If object
is a "ploidymatrix"
object, a
"ploidysample"
, "ploidylocus"
, or "ploidyone"
object can be returned depending on how many unique ploidy values there
are and how they are distributed. If object
is a
"ploidysample"
or "ploidylocus"
object, a
"ploidyone"
object can be returned.
Lindsay V. Clark
reformatPloidies
, Ploidies
test <- new("ploidymatrix", samples=c("a","b","c"), loci=c("l1","l2","l3")) pld(test) # view the ploidies pld(test) <- 2 # make it diploid at all samples and loci pld(test)["a",] <- c(2,4,4) # change the ploidies for sample a pld(test, samples=c("a","b")) # view ploidies at a subset of samples # test to see if the ploidies can be simplified p <- plCollapse(test, na.rm=FALSE, returnvalue=TRUE) p # now change a ploidy and repeat the test pld(test)["a","l1"] <- 4 p <- plCollapse(test, na.rm=FALSE, returnvalue=TRUE) p # change something else and collapse it further pld(p)["a"] <- 2 p2 <- plCollapse(p, na.rm=FALSE, returnvalue=TRUE) p2 # if na.rm=FALSE, NA values are not ignored: pld(test)["a","l1"] <- NA pld(test) plCollapse(test, na.rm=FALSE, returnvalue=TRUE) # NA values are ignored with na.rm=TRUE plCollapse(test, na.rm=TRUE, returnvalue=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.