Learn R Programming

optpart (version 3.0-3)

extract: Extract A Specific Cluster Solution From A Stride

Description

Extracts a specified cluster solution from an object of class ‘stride’. The desired solution is specified by the number of clusters.

Usage

# S3 method for stride
extract(stride,k)

Arguments

stride

an object of class ‘stride’ from function stride

k

the number of clusters desired

Value

an object of class ‘clustering’.

Details

A stride object consists of a list with a data.frame of cluster solutions for varying numbers of clusters. Extract simply selects one column of this data.frame (specified by number of clusters desired, not column number) and returns that solution as an object of class ‘clustering’.

Examples

Run this code
# NOT RUN {
data(shoshveg)		                # get vegetation data
dis.bc <- dsvdis(shoshveg,'bray')   # calculate dissimilarity 
                                    #   matrix
avg.hcl <- hclust(dis.bc,'average') # average linkage cluster 
                                    #   analysis
avg.2.10 <- stride(2:10,avg.hcl)    # compute stride
res <- extract(avg.2.10,8)          # extract 8-cluster solution
# }

Run the code above in your browser using DataLab