is.cl_partition(x)
is.cl_hard_partition(x)
is.cl_soft_partition(x)
is.cl_hierarchy(x)as.cl_partition(x)
as.cl_hard_partition(x)
as.cl_hierarchy(x)
For the coercion functions, the object itself if it already represents
a clustering of the respective type. Otherwise, an object inheriting
from "cl_membership"
or "cl_ultrametric"
when coercing to partitions or hierarchies, respectively.
is.cl_soft_partition
, the testing functions are
generic functions. The methods provided in package
is.cl_soft_partition
gives true iff is.cl_partition
is
true and is.cl_hard_partition
is false.
For as.cl_partition
and as.cl_hierarchy
, the given
object is returned if it already represents a partition or hierarchy
(i.e., the corresponding test returns true). Otherwise,
as.cl_membership
or as.cl_ultrametric
are
called, creating suitable membership or ultrametric objects if
possible.
as.cl_hard_partition(x)
returns x
if this represents a
hard partition (i.e., is.cl_hard_partition(x)
is true).
Otherwise, it returns an object of class "cl_membership"
with
the memberships of a hard partition with classes either obtained
directly from x
if this is an atomic vector of raw class ids,
or, if x
represents a soft partition or is a raw matrix of
membership values, as the class ids of the closest hard
partition, defined by taking the class ids of the (first) maximal
membership values.
Conceptually, (hard) partitions and hierarchies are virtual classes.
data("Cassini")
pcl <- kmeans(Cassini$x, 3)
is.cl_partition(pcl)
is.cl_hard_partition(pcl)
is.cl_soft_partition(pcl)
hcl <- hclust(dist(USArrests))
is.cl_partition(hcl)
is.cl_hierarchy(hcl)
Run the code above in your browser using DataLab