% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\name{compare_cycles}
\alias{compare_cycles}
\title{Compare Survey Cycles}
\usage{
compare_cycles(..., scale_points, cycle_names = NULL, plot = FALSE)
}
\arguments{
\item{...}{Two or more glint_survey objects or data frames to compare}

\item{scale_points}{Integer specifying the number of scale points (2-11)}

\item{cycle_names}{Optional character vector of names for each cycle.
If not provided, will use "Cycle 1", "Cycle 2", etc.}

\item{plot}{Logical. If \code{TRUE}, prints a line chart of Glint Score over
cycles (one line per question) and returns the data invisibly. Requires
\pkg{ggplot2}. Default: \code{FALSE}.}
}
\value{
A tibble with one row per question-cycle combination containing:
\describe{
\item{cycle}{The cycle name or number}
\item{question}{The question text}
\item{mean, sd, n_responses, n_skips, n_total}{Descriptive
statistics for this question in this cycle (see \code{summarize_survey()})}
\item{pct_favorable, pct_neutral, pct_unfavorable}{Favorability
percentages for this question in this cycle}
\item{change_from_previous}{Change in raw mean score from the previous
cycle (NA for the first cycle)}
\item{pct_change_from_previous}{Percentage change in raw mean score from
the previous cycle (NA for the first cycle)}
\item{glint_score_change_from_previous}{Change in Glint Score (0-100
scale) from the previous cycle (NA for the first cycle)}
}
When \code{plot = TRUE}, the same tibble is returned invisibly after
printing the plot.
}
\description{
Compares question-level metrics across multiple survey cycles, calculating
change scores and trends over time.
}
\examples{
survey_path <- system.file("extdata", "survey_export.csv", package = "vivaglint")
survey1 <- read_glint_survey(survey_path, emp_id_col = "EMP ID")
survey2 <- read_glint_survey(survey_path, emp_id_col = "EMP ID")
survey3 <- read_glint_survey(survey_path, emp_id_col = "EMP ID")

comparison <- compare_cycles(survey1, survey2, survey3,
                              scale_points = 5,
                              cycle_names = c("Q1 2024", "Q2 2024", "Q3 2024"))
print(comparison)

# With trend chart
if (requireNamespace("ggplot2", quietly = TRUE)) {
  compare_cycles(survey1, survey2, survey3, scale_points = 5,
                 cycle_names = c("Q1 2024", "Q2 2024", "Q3 2024"),
                 plot = TRUE)
}
}
