Description Usage Arguments Details Value Objects from the Class Slots Methods Author(s) See Also Examples
A class, with validity checking, to contain vectors of non-negative real numbers whose sum equals one.
1 | WeightVector(phi)
|
phi |
a numeric vector containing non-negative values. |
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.
The constructor returns a valid object of the WeightVector
class.
Although objects can be created using new
, the preferred method
is to use the constructor function, WeightVector
.
psi
a vector containing non-negative values whose sum equals one.
Convert the
WeightVector
object into a simple numeric vector. Never
actually used in this form, since the preferred method is to write
as(WV, "numeric")
.
Kevin R. Coombes krc@silicovore.com, Mark Zucker zucker.64@buckeyemail.osu.edu
1 2 3 4 | showClass("WeightVector")
WeightVector(1:4)
as(WeightVector(c(2, 3, 5)), "numeric")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.