Description Usage Arguments Details Examples
get_cluster_labels
returns a factor vector of cluster labels.
get_clustered_data
returns a matrix (with the same dimensions and names
as the original data), but with the values for each observation replaced by
its "estimated" value (i.e., the appropriate cluster centroid).
get_cluster_centroids
returns a k
-by-p
matrix of cluster
centroids, with the same column names as the original data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | get_cluster_labels(x, ...)
## S3 method for class 'CARP'
get_cluster_labels(x, ..., percent, k)
get_cluster_centroids(x, ...)
## S3 method for class 'CARP'
get_cluster_centroids(x, ..., percent, k, refit = TRUE)
get_clustered_data(x, ...)
## S3 method for class 'CARP'
get_clustered_data(x, ..., percent, k, refit = TRUE)
|
x |
An object of class |
... |
Additional arguments - if any are provided, an error is signalled. |
percent |
A number between 0 and 1, giving the regularization level (as a fraction of the final regularization level used) at which to get cluster labels. |
k |
The desired number of clusters. If no iteration with exactly this
many clusters is found, the first iterate with fewer than |
refit |
Should "naive" centroids ( |
get_clustered_data
and get_cluster_centroids
return
centroids on the original scale of the data, independent of any pre-processing
flags passed to CARP
. Note that exactly one of percent
and
k
must be supplied to each function.
1 2 3 4 5 6 7 8 9 10 11 12 13 | carp_fit <- CARP(presidential_speech)
# Get clustering results from 50% along the path
get_cluster_labels(carp_fit, percent = 0.5)
# Get labels corresponding to the 3 cluster solution
get_cluster_labels(carp_fit, k = 3)
# Get 3 cluster centroids
get_cluster_centroids(carp_fit, k = 3)
# Get the clustered estimates for k = 3 clusters
get_clustered_data(carp_fit, k = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.