quote_tags: List the tags of the quotes database

quote_tagsR Documentation

List the tags of the quotes database

Description

This function finds the unique tags of items in the quotes database and returns them as vector or a one-way table giving their frequencies.

Usage

quote_tags(table = FALSE)

Arguments

table

Logical. If table=TRUE, return a one-way frequency table of quotes for each tag; otherwise return the sorted vector of unique tags.

Value

Returns either a vector of tags in the quotes database or a one-way frequency table of the number of quotes for each tag.

Examples

quote_tags()
quote_tags(table=TRUE)

library(ggplot2)
qt <- quote_tags(table=TRUE)
qtdf <-as.data.frame(qt)
# bar plot of frequencies
ggplot2::ggplot(data=qtdf, aes(x=Freq, y=tags)) +
    geom_bar(stat = "identity")

# Sort tags by frequency
qtdf |>
  dplyr::mutate(tags = forcats::fct_reorder(tags, Freq)) |>
  ggplot2::ggplot(aes(x=Freq, y=tags)) +
  geom_bar(stat = "identity")


statquotes documentation built on Oct. 10, 2023, 5:07 p.m.