Function reference

This page provides a complete listing of all exported vivaglint functions grouped by theme, along with reference tables for the Glint Score formula, favorability thresholds, and standard column names.

Function summary

Import and validation

Function Purpose Returns Plot support
read_glint_survey() Import and validate a Viva Glint CSV export glint_survey object No
extract_questions() Parse column names and return question metadata Tibble No
join_attributes() Join employee attribute data to a survey glint_survey or data frame No

Reshape

Function Purpose Returns Plot support
pivot_long() Reshape survey from wide to long format Tibble or named list No
split_survey_data() Separate numeric responses from comment data Named list No

Analysis

Function Purpose Returns Plot support
summarize_survey() Per-question mean, SD, Glint Score, favorability Tibble Yes
get_response_dist() Count and percentage per response value per question Tibble Yes
compare_cycles() Metrics and change scores across multiple survey cycles Tibble Yes
get_correlations() Pairwise inter-question correlations with p-values Tibble or matrix Yes (long format)
extract_survey_factors() Exploratory factor analysis with loading summary Named list Yes
analyze_attrition() Attrition rates by favorability group across time windows Tibble Yes
analyze_by_attributes() Survey metrics segmented by employee attributes Tibble Yes
search_comments() Full-text search across all comment columns Tibble No

Hierarchy

Function Purpose Returns Plot support
aggregate_by_manager() Survey metrics rolled up to manager-team level Tibble Yes

Function details

read_glint_survey

Import and validate a Viva Glint survey CSV export. See Getting Started for details.

read_glint_survey(file_path, encoding = "UTF-8")
Parameter Type Default Description
file_path character (required) Path to the CSV export file
encoding character "UTF-8" File encoding; use "latin1" if characters appear garbled

Returns: glint_survey object with $data (tibble) and $metadata (list).


extract_questions

Parse column names and return a tibble mapping each question stem to its related columns.

extract_questions(data)
Parameter Type Default Description
data glint_survey or data frame (required) Survey data

Returns: Tibble with columns question, response_col, comment_col, topics_col, flag_col.


join_attributes

Join employee attribute data to a survey for demographic analysis. See Getting Started for the two recommended workflows.

join_attributes(survey, attribute_source, emp_id_col)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey to enrich
attribute_source character or data frame (required) CSV file path or data frame containing attributes
emp_id_col character (required) Employee ID column present in both survey and attribute source

Returns: Enriched glint_survey (if input was glint_survey) or joined data frame.


pivot_long

Reshape survey data from wide format (one row per respondent) to long format (one row per respondent–question pair).

pivot_long(survey, data_type = "all", include_empty = FALSE, include_standard_cols = TRUE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
data_type character "all" "all", "comments" (only rows with comments), or "both" (returns named list)
include_empty logical FALSE Include rows with empty comment text when data_type = "comments"
include_standard_cols logical TRUE Include standard respondent columns in output

Returns: Long-format tibble with columns: standard columns (if included), question, response, comment, comment_topics, sensitive_flag. When data_type = "both", returns a named list with $all and $comments.


split_survey_data

Separate a survey into quantitative (numeric responses) and qualitative (comments, topics, flags) components.

split_survey_data(survey, emp_id_col)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
emp_id_col character (required) Employee ID column name (used as join key in output)

Returns: Named list with $quantitative (standard columns + numeric response columns) and $qualitative (employee ID + comment, topics, and flag columns).


summarize_survey

Calculate per-question metrics including mean, SD, Glint Score, response counts, and favorability percentages. See Core Analysis for full details.

summarize_survey(survey, scale_points, questions = "all", plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
scale_points integer (required) Number of scale points (2–11)
questions character vector "all" Question text(s) to analyze, or "all"
plot logical FALSE Print favorability stacked bar chart; requires ggplot2

Returns: Tibble with columns question, mean, sd, glint_score, n_responses, n_skips, n_total, pct_favorable, pct_neutral, pct_unfavorable. When plot = TRUE, returns data invisibly.


get_response_dist

Calculate the count and percentage of respondents selecting each scale value for every question.

get_response_dist(survey, questions = "all", plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
questions character vector "all" Question text(s) to analyze, or "all"
plot logical FALSE Print stacked distribution chart; requires ggplot2

Returns: Wide tibble with columns question, count_1, pct_1, count_2, pct_2, ... up to the maximum observed response value.


compare_cycles

Compare question metrics across two or more survey cycles, adding change scores relative to the prior cycle. See Trends, Segmentation, and Hierarchy.

compare_cycles(..., scale_points, cycle_names = NULL, plot = FALSE)
Parameter Type Default Description
... glint_survey or data frame (required) Two or more survey objects in chronological order
scale_points integer (required) Number of scale points (2–11)
cycle_names character vector NULL Labels for each cycle; defaults to "Cycle 1", "Cycle 2", etc.
plot logical FALSE Print Glint Score line chart; requires ggplot2

Returns: Tibble with all summarize_survey() columns plus cycle, change_from_previous, pct_change_from_previous, glint_score_change_from_previous.


get_correlations

Calculate pairwise correlations between all survey question response columns. See Correlations, Factors, and Attrition.

get_correlations(survey, method = "pearson", format = "long",
                 use = "pairwise.complete.obs", plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
method character "pearson" "pearson", "spearman", or "kendall"
format character "long" "long" (one row per pair) or "matrix"
use character "pairwise.complete.obs" Passed to R's cor() for missing value handling
plot logical FALSE Print heatmap (long format only); requires ggplot2

Returns: Tibble (question1, question2, correlation, p_value, n) when format = "long", or numeric matrix when format = "matrix".


extract_survey_factors

Run exploratory factor analysis on survey responses to identify latent constructs. Requires the psych package. See Correlations, Factors, and Attrition.

extract_survey_factors(survey, n_factors = NULL, rotation = "oblimin",
                       min_loading = 0.3, fm = "minres", plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
n_factors integer or NULL NULL Factors to extract; NULL runs parallel analysis
rotation character "oblimin" "oblimin", "varimax", "promax", "quartimax", "equamax", or "none"
min_loading numeric 0.3 Minimum absolute loading to include in $factor_summary
fm character "minres" "minres", "ml", "pa", "wls", "gls", or "uls"
plot logical FALSE Print factor loading heatmap; requires ggplot2

Returns: Named list with $factor_summary (tibble: question, factor, loading, loading_label, communality, factor_variance_pct) and $fa_object (original psych::fa object).


analyze_attrition

Link survey responses to termination records and calculate attrition rates by favorability group. See Correlations, Factors, and Attrition.

analyze_attrition(survey, attrition_file, emp_id_col, term_date_col,
                  scale_points, time_periods = c(90, 180, 365),
                  attribute_cols = NULL, min_group_size = 5, plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data (must contain Survey Cycle Completion Date)
attrition_file character (required) Path to CSV with employee IDs and termination dates
emp_id_col character (required) Employee ID column in both survey and attrition file
term_date_col character (required) Termination date column in attrition file
scale_points integer (required) Number of scale points (2–11)
time_periods integer vector c(90, 180, 365) Days after survey to measure attrition
attribute_cols character vector NULL Pre-joined attribute columns for segmented results
min_group_size integer 5 Minimum employees per attribute group
plot logical FALSE Print attrition bar chart; requires ggplot2

Returns: Tibble with columns question, days, favorable_n, favorable_attrition, unfavorable_n, unfavorable_attrition, attrition_ratio. When attribute_cols is supplied, attribute columns and group_size are prepended.


analyze_by_attributes

Calculate survey metrics segmented by employee attribute groups. See Trends, Segmentation, and Hierarchy.

analyze_by_attributes(survey, attribute_file = NULL, scale_points,
                      attribute_cols, emp_id_col, min_group_size = 5, plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data (attributes pre-joined or supply via attribute_file)
attribute_file character or data frame NULL File path or data frame with employee attributes; omit if already joined
scale_points integer (required) Number of scale points (2–11)
attribute_cols character vector (required) Column names to group by
emp_id_col character (required) Employee ID column name
min_group_size integer 5 Minimum employees per group (privacy safeguard)
plot logical FALSE Print faceted dot plot; requires ggplot2

Returns: Tibble with attribute columns, group_size, and all summarize_survey() columns.


search_comments

Full-text search across all comment columns using exact or fuzzy matching.

search_comments(survey, query, exact = FALSE, max_distance = 0.2)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
query character (required) Non-empty search string
exact logical FALSE Case-sensitive literal substring match
max_distance numeric (0–1) 0.2 Fuzzy match tolerance; ignored when exact = TRUE

Returns: Tibble with columns question, response, comment, topics. Returns an empty tibble (not an error) when no matches are found.


aggregate_by_manager

Roll up survey metrics to the manager level. See Trends, Segmentation, and Hierarchy.

aggregate_by_manager(survey, scale_points, emp_id_col, manager_id_col,
                     full_tree = FALSE, plot = FALSE)
Parameter Type Default Description
survey glint_survey or data frame (required) Survey data
scale_points integer (required) Number of scale points (2–11)
emp_id_col character (required) Employee ID column name
manager_id_col character (required) Manager ID column name
full_tree logical FALSE If TRUE, aggregate all direct and indirect reports
plot logical FALSE Print ranked lollipop chart; requires ggplot2

Returns: Tibble with columns manager_id, manager_name, question, team_size, and all summarize_survey() columns.


Glint Score formula

The Glint Score normalizes any response scale (2–11 points) to a 0–100 range, matching the score displayed in the Viva Glint UI. All analysis functions that accept scale_points use this formula internally.

Glint Score = round(((mean - 1) / (scale_points - 1)) * 100)

Examples:

  • Mean 4.2 on a 5-point scale → round(((4.2 - 1) / (5 - 1)) * 100) = 80
  • Mean 3.0 on a 5-point scale → round(((3.0 - 1) / (5 - 1)) * 100) = 50
  • Mean 6.5 on a 7-point scale → round(((6.5 - 1) / (7 - 1)) * 100) = 92

Favorability thresholds

Favorability classification follows Viva Glint's standard definitions. The scale_points value you pass to analysis functions determines which response values fall into each category.

Scale points Favorable Neutral Unfavorable
2 2 — 1
3 3 2 1
4 4 2, 3 1
5 4, 5 3 1, 2
6 4, 5, 6 — 1, 2, 3
7 6, 7 4, 5 1, 2, 3
8 6, 7, 8 4, 5 1, 2, 3
9 7, 8, 9 4, 5, 6 1, 2, 3
10 8, 9, 10 4, 5, 6, 7 1, 2, 3
11 10, 11 8, 9 1, 2, 3, 4, 5, 6, 7

Standard columns

Every Viva Glint export must contain these eight columns. read_glint_survey() validates their presence at import time and raises an error if any are missing.

Column name Description
First Name Respondent first name
Last Name Respondent last name
Email Respondent email address
Status Survey completion status
EMP ID Employee ID — primary join key for attribute and attrition data
Manager ID Manager's employee ID — used by aggregate_by_manager()
Survey Cycle Completion Date Date and time the survey was completed (parsed to date-time)
Survey Cycle Sent Date Date and time the survey invitation was sent (parsed to date-time)