lonelyr

Scoring functions for common loneliness scales, with the response keys and reverse-scoring taken from each scale's original manual. The point is to stop reverse-coding and reporter errors. Every key is verified against source's manual, out-of-range responses raise a warning, and missing-data rules follow each scale's manual.

Scales

Key Scale Source
ucla20 UCLA Loneliness Scale Version 3 (20-item) Russell (1996)
ucla3 / tils Three-Item Loneliness Scale Hughes et al. (2004)
djg11 De Jong Gierveld Loneliness Scale (11-item) de Jong Gierveld & Van Tilburg (1999)
djg6 De Jong Gierveld Loneliness Scale (6-item) de Jong Gierveld & Van Tilburg (2006)
lsdq Children's Loneliness and Social Dissatisfaction Scale Asher, Hymel, & Renshaw (1984)
selsa_s Social and Emotional Loneliness Scale for Adults, Short DiTommaso, Brannen, & Best (2004)

Install

# install.packages("remotes")
# remotes::install_github("nsbyrd/lonelyr")
install.packages("lonelyr", repos = c('https://nsbyrd.r-universe.dev', 'https://cloud.r-project.org'))
library(lonelyr)

Use

Pass the item columns in scale order. The dispatcher reads the key from the registry and returns a data frame of scores.

library(lonelyr)
# UCLA-20: reverse items handled internally
score_loneliness(df, ucla_items, "ucla20")
# de Jong scales need the "more or less" code: 2 on a 3-point coding,
# 3 on a 5-point coding
score_loneliness(df, djg_items, "djg11", neutral = 2, bands = TRUE)
# SELSA-S returns social, family, romantic, and combined emotional means
score_loneliness(df, selsa_items, "selsa_s")

Each engine is also callable directly (score_likert, score_djg, score_lsdq, score_selsa_s) if you want to override.

Scoring notes