Skip to contents

Runs descriptive analyses offline. Thematic analysis and a model-generated summary are opt-in and run only when config is supplied.

Usage

analyze_focus_group(
  focus_group_result,
  num_topics = 5,
  include_plots = TRUE,
  speakers = c("participants", "all"),
  language = "en",
  config = NULL,
  .runner = NULL
)

Arguments

focus_group_result

A FocusGroup object or focus_group_result. A result whose focus_group is NULL, as one saved without its session object, is read back with focus_group_from_transcript().

num_topics

Integer number of topics for topic modeling.

include_plots

Logical. Attempt the four descriptive plots.

speakers

Whose turns the text statistics describe: "participants" (default) excludes the moderator's scripted turns; "all" keeps them. The transcript itself always retains every turn.

language

Language of the transcript (default "en"). The TF-IDF stop-word list and the readability formula are English-specific, so those components are skipped, with a note in issues, for any other value.

config

Optional explicit LLMR::llm_config. When supplied, thematic analysis and a model summary are generated.

.runner

Optional function used instead of live model calls for the two model analyses.

Value

A focus_group_analysis containing the returned analysis components, basic_stats, topics, tfidf, readability, themes, model_summary, and plots, and an issues table with columns component and reason for the components that were skipped or failed.

Details

The two model analyses add their usage to the token fields of the FocusGroup object, including calls made before one of them fails. The usage component of a focus_group_result passed in is not changed: it records the session as run. An error from a model analysis is not caught.

Examples

transcript <- data.frame(
  speaker = c("Moderator", "P1", "P2"),
  text = c("What matters most?", "Cost matters.", "Access matters.")
)
fg <- focus_group_from_transcript(transcript)
analysis <- analyze_focus_group(fg, include_plots = FALSE)
analysis$basic_stats$speaker_stats
#> # A tibble: 2 × 4
#>   speaker_id utterance_count total_words avg_words_per_utterance
#>   <fct>                <int>       <int>                   <dbl>
#> 1 P1                       1           2                       2
#> 2 P2                       1           2                       2