words_freq_plot {deepMOU} | R Documentation |
Graph of most frequent words of each cluster
Description
Graphical plot of the most frequent words of each cluster
Usage
words_freq_plot(
x,
clusters,
clust_label = NULL,
n_words = 5,
words_size = 2,
axis_size = 1,
set_colors = NA,
main = "Most frequent words for each cluster",
xlabel = "",
ylabel = ""
)
Arguments
x |
Document-term matrix describing the frequency of terms that occur in a collection of documents. Rows correspond to documents in the collection and columns correspond to terms. |
clusters |
Integer vector of length of the number of cases, which indicates a clustering. The clusters have to be numbered from 1 to the number of clusters. |
clust_label |
Vector of length of the number of cluster containing the cluster names to be displayed (by default |
n_words |
Number of words to display. |
words_size |
A numerical value giving the amount by which plotting words should be magnified with respect to the default setting. |
axis_size |
Magnification to be used for axis annotation with respect to the default setting. |
set_colors |
Choose palette for word colors. |
main |
A title for the plot. Default is |
xlabel |
A title for the x-axis. Default is empty. |
ylabel |
A title for the y-axis. Default is empty. |
Details
The number of most frequent words to be shown can be set by
n_words
and also clusters names can be passed beforehand as a character
vector to clust_label
Value
A graphical aid for visualizing the most frequent terms for each cluster.
Examples
# Load the CNAE2 dataset
data("CNAE2")
# Perform parameter estimation and clustering
mou_CNAE2 = mou_EM(x = CNAE2, k = 2)
# Usage of the function
words_freq_plot(mou_CNAE2$x, mou_CNAE2$clusters,n_words = 4, words_size = 2, main = "Example" )