compare: Compare wrapper function

Description Usage Arguments Details Examples

Description

Compare wrapper function

Usage

1
2
compare(clustering_solution, compare_which, which_clusters = NULL,
  which_groups = NULL)

Arguments

clustering_solution

The output from the cluster function.

compare_which

A factor variable of the groups of interest for comparison.

which_clusters

Clusters to be included in the comparison. Default is all clusters.

which_groups

Levels of the grouping factor to be included in the comparison. Default is all levels.

Details

Function for comparing clustering solution between subgroups. Output is contingency table for the specified groups and clusters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(clustRcompaR)
library(dplyr)
library(quanteda)

d <- inaugural_addresses
d <- mutate(d, century = ifelse(Year < 1800, "17th",
                                ifelse(Year >= 1800 & Year < 1900, "18th",
                                       ifelse(Year >= 1900 & Year < 2000, "19th", "20th"))))

three_clusters <- cluster(d, century, n_clusters = 3)
extract_terms(three_clusters)

three_clusters_comparison <- compare(three_clusters, "century")
compare_plot(three_clusters_comparison)

alishinski/clustRcompaR documentation built on May 12, 2019, 9:54 a.m.