Skip to contents

This function summarizes how many times each code was applied by each coder, and presents the data in a wide format: one row per code, one column per coder, along with two total count columns:

  • Total count from all coders (regardless of preference)

  • Total count from preferred coders only (one coder per media title, selected in order of preference)

Usage

summarize_codes(
  excerpts,
  preferred_coders,
  output_type = c("tibble", "kable", "datatable")
)

Arguments

excerpts

A data frame of coded excerpts, typically read from an Excel file. Must include a column Excerpt Creator indicating who coded each excerpt, a column Media Title identifying the transcript, and columns prefixed with Code: for each code (binary indicators).

preferred_coders

A character vector of coder names in preferred order, used to resolve duplicates when multiple coders coded the same transcript.

output_type

A string indicating the output format: one of "tibble", "kable", or "datatable". Defaults to "tibble".

Value

A table summarizing the number of times each code was applied by each coder, including total counts from all coders and from preferred coders only. The format depends on output_type.

Examples

if (FALSE) { # \dontrun{
excerpts <- readxl::read_xlsx("data/my_coded_excerpts.xlsx")
preferred_coders <- c("s", "r", "l", "a")
summarize_codes(excerpts, preferred_coders, output_type = "datatable")
} # }