WeightVector-class {CloneSeeker} | R Documentation |
Class "WeightVector"
Description
A class, with validity checking, to contain vectors of non-negative real numbers whose sum equals one.
Usage
WeightVector(phi)
Arguments
phi |
a numeric vector containing non-negative values. |
Details
When trying to simulate or model biological data from (sub)clonal
populations of cells, we need vectors that keep track of the fraction
of cells belonging to each clone. These vectors can only contain
non-negative entries, and the entries must add up to one. (We
thought about calling these things "ClonalFractions", but that seems
overly specialized for a notion that is likely to prove useful in
other contexts.) Such vectors of length d
can also be viewed as
points of a d-dimensional simplex.
We have implemented WeightVector
s as an S4 class, primarily so
we can enforce the defining properties. We also expect this design to
make it easier to use them as slots in other classes.
Value
The constructor returns a valid object of the WeightVector
class.
Objects from the Class
Although objects can be created using new
, the preferred method
is to use the constructor function, WeightVector
.
Slots
psi
a vector containing non-negative values whose sum equals one.
Methods
- coerce(from, to, strict = TRUE)
Convert the
WeightVector
object into a simple numeric vector. Never actually used in this form, since the preferred method is to writeas(WV, "numeric")
.
Author(s)
Kevin R. Coombes krc@silicovore.com, Mark Zucker zucker.64@buckeyemail.osu.edu
See Also
Examples
showClass("WeightVector")
WeightVector(1:4)
as(WeightVector(c(2, 3, 5)), "numeric")