Wordcloud from tf-idf results

wordcloud_tfidf(
  obj,
  label_var = "celltype",
  cluster_var = "cluster",
  terms_per_cluster = 10,
  show_plot = TRUE,
  ...
)

Arguments

obj

Single-cell data object.

label_var

Which cell metadata column to input to NLP analysis.

cluster_var

Which cell metadata column to use to identify which cluster each cell is assigned to.

terms_per_cluster

The maximum number of words to return per cluster.

show_plot

Whether to print the plot.

...

Additional parameters passed to ggplot2::ggplot(aes(...)).

Value

A list containing:

plot

The wordcloud ggplot object.

tfidf_df

The TF-IDF results data.frame.

Examples

data("pseudo_seurat")
if (requireNamespace("ggwordcloud", quietly = TRUE)) {
    wordcloud_res <- wordcloud_tfidf(obj = pseudo_seurat,
                                     label_var = "celltype",
                                     cluster_var = "cluster")
}
#> Extracting obsm from Seurat: umap
#> + Dropping 2 conflicting obs variables: UMAP.1, UMAP.2
#> Setting cell metadata (obs) in obj.
#> Warning: Ignoring unknown aesthetics: label