Skip to content

Tip

One-line classification in a tidy pipeline
No model training, no JSON parsing — just mutate().

Installation

# install.packages("remotes")
remotes::install_github("dante042/classifyLLM")

Quick example

df <- tibble(
  id = 1:5,
  text = c(
    "Great progress on the program.",
    "This is unacceptable performance.",
    "Neutral report with mixed results.",
    "Strong positive outcomes in protection.",
    "Severe constraints and delays reported."
  )
)

df |>
  mutate(
    sentiment = classify_llm(
      text,
      categories = c("Positive", "Neutral", "Negative")
    )
  )

Use with across()

df |>
  mutate(
    across(text, ~ classify_llm(.x, categories = c("Pos","Neg","Neutral")))
  )

Note

Reproducibility: set temperature = 0 to minimize randomness and pin the model version for consistent results.