Import, score, and analyse ScoreMe questionnaire data in R.
Warning
tallieR is in early development and has not been formally tested. The API may change without notice, scoring algorithms have not been validated against reference implementations, and the package has not undergone peer review. Use with caution and verify outputs independently before using in any research context.
tallieR is the official R companion to the ScoreMe app. When a study session ends, ScoreMe exports all participant data as a single JSON file. tallieR reads that file โ or a whole directory of exports โ re-scores every questionnaire from raw item-level responses using the same algorithms embedded in the app, and hands you tidy data frames ready for downstream analysis.
It covers 27 validated instruments across five clinical domains: sleep, mental health, wellbeing, physical activity, and neurodevelopmental screening. Custom instruments defined in ScoreMe-compatible JSON files can be loaded and scored with the same API, without modifying the package.
tallieR is designed to work alongside slumbR: ScoreMe handles the questionnaire side of a study, Sleep Diaries handles the diary side, and the two R packages bring both data streams together in R.
- ๐ฅ
read_scoreme()โ parse a ScoreMe JSON export into a structuredtallier_exportobject - ๐
read_scoreme_dir()โ batch-read a whole directory of exports into atallier_study - ๐
scores_wide()โ one row per participant, one column per questionnaire (most recent session) - ๐
scores_long()โ one row per participant ร questionnaire ร administration (full history retained) - ๐ฌ
items_long()โ one row per item response; optionalscored_items = TRUEapplies reverse-scoring - โ
completion_summary()โ participant ร questionnaire completion matrix (long or wide format) - ๐งฎ
score_questionnaire()โ re-score any built-in instrument from a raw answers list - ๐ฌ
interpret_score()โ return the clinical score band (label, colour, description) for any score - ๐ฌ
interpret_all()โ return clinical interpretations for all results in a study as a long data frame - ๐
available_instruments()โ list all supported questionnaires with IDs, domains, beta status, reverse-scoring flags, and areturns_listindicator for composite instruments - ๐
load_instrument()โ compile a custom questionnaire from a ScoreMe JSON spec - ๐
load_instrument_dir()โ batch-load a directory of custom instrument specs - ๐
cronbach_alpha()โ compute Cronbach's ฮฑ with exact 95% CIs for any questionnaire in the data - ๐
omega_reliability()โ compute McDonald's ฯ (total omega) via single-factor EFA - ๐๏ธ
summary()โ print participant count, instruments, completion rates, and date range for any study object - ๐
tibble::as_tibble()โ coerce any study object directly to a tibble viascores_wide()
tallieR/
โโโ R/
โ โโโ tallieR-package.R # package-level docs and workflow overview
โ โโโ import.R # read_scoreme(), read_scoreme_dir(),
โ โ # print/summary S3 methods
โ โโโ tidy.R # scores_wide(), scores_long(), items_long(),
โ โ # completion_summary(), as_tibble methods
โ โโโ questionnaires.R # score_questionnaire(), interpret_score(),
โ โ # interpret_all(), available_instruments(),
โ โ # score_all()
โ โโโ questionnaires_sleep.R # ESS, ISI, DBAS-16, MEQ, PSQI, RU-SATED,
โ โ # STOP-BANG, KSS, MCTQ
โ โโโ questionnaires_mental_health.R # PHQ-2/9/15, GAD-7/2, BDI-II, BAI,
โ โ # DASS-21, PANSS, STAI-S/T
โ โโโ questionnaires_wellbeing.R # WHOQOL-BREF, MacArthur SSS
โ โโโ questionnaires_physical_activity.R # IPAQ-S, GPAQ
โ โโโ questionnaires_neurodevelopmental.R # GSQ, AQ-10
โ โโโ custom_instruments.R # load_instrument(), load_instrument_dir()
โ โโโ reliability.R # cronbach_alpha(), omega_reliability()
โ โโโ zzz.R # `%||%` operator; .onLoad() assembles .INSTRUMENTS registry
โโโ inst/extdata/
โ โโโ example_export.json # bundled 2-participant simulated export
โ โโโ example_instrument.json # example custom instrument spec
โโโ man/ # roxygen2-generated documentation
โโโ vignettes/
โ โโโ getting-started.Rmd # end-to-end worked example
โ โโโ custom-instruments.Rmd # loading and scoring custom questionnaires
โโโ tests/testthat/
โ โโโ test-questionnaires.R
โ โโโ test-import.R
โ โโโ test-reliability.R
โโโ logo.png
โโโ DESCRIPTION
โโโ LICENSE
โโโ tallieR.Rproj
- R โฅ 4.1
- The following packages (installed automatically):
jsonlite,dplyr,tidyr,purrr,rlang,cli
# Install from GitHub (requires remotes)
remotes::install_github("circadia-bio/tallieR")library(tallieR)
# โโ Single export file โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
exp <- read_scoreme("my_study_export.json")
exp
#> โน tallier_export: 12 participants | exported 2026-05-14T10:00:00.000Z
#> Instruments (4): ess, isi, meq, psqi
# โโ Wide table: one row per participant โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
wide <- scores_wide(exp)
wide[, c("code", "age", "sex", "ess", "isi", "meq", "phq9")]
#> code age sex ess isi meq phq9
#> 1 P001 28 female 10 5 59 3
#> 2 P002 45 male 20 22 NA 14
# โโ Long table: full administration history โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
long <- scores_long(exp)
head(long[, c("code", "questionnaire_id", "completed_at", "score")])
# โโ Item-level data โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
items <- items_long(exp)
head(items[, c("code", "questionnaire_id", "item_id", "response")])
# โโ Re-score a questionnaire directly โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
score_questionnaire("ess", list(
ess1 = 2, ess2 = 1, ess3 = 0, ess4 = 3,
ess5 = 1, ess6 = 0, ess7 = 2, ess8 = 1
))
#> [1] 10
interpret_score("ess", 10)
#> $label
#> [1] "Excessive"
#> $color
#> [1] "#EA580C"
#> $description
#> [1] "Excessive daytime sleepiness. Consider clinical review."Note
The bundled dataset is entirely simulated. The two participants (Alice Example, Bob Example) and all their questionnaire responses are artificially generated for demonstration purposes. They do not represent real people or real study data.
path <- system.file("extdata", "example_export.json", package = "tallieR")
exp <- read_scoreme(path)
wide <- scores_wide(exp)See vignette("getting-started", package = "tallieR") for a full worked example.
| ID | Full name | Score range | Reference |
|---|---|---|---|
ess |
Epworth Sleepiness Scale | 0โ24 | Johns (1991) |
isi |
Insomnia Severity Index | 0โ28 | Morin et al. (2011) |
dbas16 |
Dysfunctional Beliefs and Attitudes about Sleep | 0โ10 (mean) | Morin et al. (2007) |
meq |
MorningnessโEveningness Questionnaire | 16โ86 | Horne & รstberg (1976) |
psqi |
Pittsburgh Sleep Quality Index | 0โ21 + C1โC7 | Buysse et al. (1989) |
rusated |
RU-SATED Sleep Health Scale | 0โ24 | Buysse (2014) |
stopbang |
STOP-BANG Questionnaire | 0โ8 | Chung et al. (2016) |
kss |
Karolinska Sleepiness Scale | 1โ10 | ร kerstedt & Gillberg (1990) |
mctq |
Munich Chronotype Questionnaire | MSFsc + SJL (hours) | Roenneberg et al. (2003) |
Note on PSQI:
score_questionnaire("psqi", answers)returns a named list withglobaland seven component scores (C1โC7). Useresult$globalfor the total.
Note on MCTQ:
score_questionnaire("mctq", answers)returns a named list:msfsc(corrected mid-sleep on free days, decimal hours),sjl(absolute social jetlag, hours),sjl_rel(signed social jetlag, hours),msw,msf,sd_w,sd_f,sd_week(weighted average sleep duration),alarm_w,alarm_f(logical alarm flags,NAif not captured). Expected answer keys:bt_w,sl_w,wt_w,bt_f,sl_f,wt_f(times as{hour, minute}lists or decimal hours; latencies as numeric minutes),wd(workdays per week), and optionallyalarm_w/alarm_f("yes"/"no").
| ID | Full name | Score range |
|---|---|---|
phq2 |
Patient Health Questionnaire โ 2 items | 0โ6 |
phq9 |
Patient Health Questionnaire โ 9 items | 0โ27 |
phq15 |
Patient Health Questionnaire โ 15 items (somatic) | 0โ30 |
gad7 |
Generalised Anxiety Disorder โ 7 items | 0โ21 |
gad2 |
Generalised Anxiety Disorder โ 2 items | 0โ6 |
bdi2 |
Beck Depression Inventory โ Second Edition | 0โ63 |
bai |
Beck Anxiety Inventory | 0โ63 |
dass21 |
Depression Anxiety Stress Scales โ 21 items | 0โ42 + subscales |
panss |
Positive and Negative Syndrome Scale | 30โ210 + subscales |
stai_s |
State-Trait Anxiety Inventory โ State subscale | 20โ80 |
stai_t |
State-Trait Anxiety Inventory โ Trait subscale | 20โ80 |
Note on DASS-21: returns a named list with
total,depression,anxiety, andstresssubscale scores (all scaled ร 2 to align with DASS-42 norms).
Note on PANSS: returns a named list with
total,positive,negative, andgeneralsubscale scores.
| ID | Full name | Score range |
|---|---|---|
whoqol_bref |
WHO Quality of Life โ Brief | 0โ100 (+ 4 domain scores) |
macarthur_sss |
MacArthur Scale of Subjective Social Status | 0โ20 |
Note on WHOQOL-BREF: returns a named list with
totaland four domain scores (physical,psychological,social,environment), each scaled 0โ100.
| ID | Full name | Score |
|---|---|---|
ipaq_short |
International Physical Activity Questionnaire โ Short Form | MET-min/week |
gpaq |
Global Physical Activity Questionnaire | MET-min/week |
| ID | Full name | Score range |
|---|---|---|
gsq |
Glasgow Sensory Questionnaire | 0โ112 |
aq10 |
Autism Spectrum Quotient โ 10 item screener | 0โ10 |
Note on licensing: Several instruments require institutional permission for research use. Please verify licensing requirements for each instrument before use in a study.
Instruments marked beta are included in ScoreMe and have scoring ported from the app, but have not yet been independently validated in tallieR. A warning is emitted when scoring beta instruments; suppress with suppressWarnings() if intentional.
tallieR can score questionnaires not built into the package, as long as they are defined in a ScoreMe-compatible JSON spec. This allows study-specific or proprietary instruments to flow through the same pipeline without modifying tallieR source code.
# Load a single custom instrument
my_instr <- load_instrument("path/to/fss.json")
# Score it with the standard API
score_questionnaire("fss", answers, instruments = my_instr)
# Load a whole directory of specs
custom <- load_instrument_dir("instruments/")
# Use with read_scoreme() so custom instruments are scored on import
exp <- read_scoreme("export.json", instruments = custom)
wide <- scores_wide(exp)Supported scoring types compiled from the JSON spec: "sum", "weighted_sum", "mean". Instruments with "composite" scoring (e.g. PSQI-style multi-component algorithms) can be loaded but return NA for scoring; you can override the compiled score function by assigning a custom one after loading:
my_instr$my_id$score <- function(answers) { ... }See vignette("custom-instruments", package = "tallieR") and
system.file("extdata", "example_instrument.json", package = "tallieR") for the full JSON spec schema.
cronbach_alpha() computes Cronbach's ฮฑ with exact 95% confidence intervals (Feldt et al., 1987). omega_reliability() computes McDonald's ฯ_t (total omega) via single-factor EFA โ generally preferred for non-tau-equivalent items. Both functions share the same interface and output shape, making them easy to compare side by side.
study <- read_scoreme_dir("exports/")
# Cronbach's alpha with exact CIs
cronbach_alpha(study)
#> questionnaire_id alpha ci_lower ci_upper n_items n_obs note
#> ess 0.87 0.82 0.91 8 48 NA
#> isi 0.91 0.87 0.94 7 48 NA
#> ...
# McDonald's omega
omega_reliability(study)
# Compare both side by side
alpha <- cronbach_alpha(study, questionnaires = c("ess", "isi"))
omega <- omega_reliability(study, questionnaires = c("ess", "isi"))
merge(alpha[, c("questionnaire_id", "alpha", "n_obs")],
omega[, c("questionnaire_id", "omega")],
by = "questionnaire_id")
# Both accept an items_long() data frame directly
items <- items_long(study)
cronbach_alpha(items)Non-numeric items (MCTQ clock times, STOP-BANG yes/no) are silently dropped before estimation.
summary() gives a quick overview of any study object. completion_summary() returns a tidy data frame of completion status per participant and questionnaire โ useful for longitudinal data monitoring.
# Quick console overview
summary(study)
#> โโ tallier_study โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
#> โข Participants: 48
#> โข Source files: 3
#> โข Instruments: 9
#> โโ Completion โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
#> ess: 48/48 (100%)
#> isi: 45/48 (93.8%)
#> ...
# Programmatic access
s <- summary(study)
s$completion
# Tidy completion matrix (long format)
completion_summary(study)
# Wide format: one row per participant, one column per questionnaire
completion_summary(study, wide = TRUE)interpret_all() returns a long data frame of clinical interpretations for every result in a study, joinable with scores_long() on participant_id + questionnaire_id + completed_at.
interps <- interpret_all(study)
head(interps[, c("code", "questionnaire_id", "score", "label", "description")])
# Join with scores for a complete picture
scores <- scores_long(study)
full <- merge(
scores,
interps[, c("participant_id", "questionnaire_id", "completed_at",
"label", "color", "description")],
by = c("participant_id", "questionnaire_id", "completed_at"),
all.x = TRUE
)| Package | Version | Purpose |
|---|---|---|
| jsonlite | โฅ 1.8.0 | JSON parsing |
| dplyr | โฅ 1.1.0 | Data manipulation |
| tidyr | โฅ 1.3.0 | Pivoting wide/long |
| purrr | โฅ 1.0.0 | Functional iteration |
| rlang | โฅ 1.1.0 | Error/warning infrastructure |
| cli | โฅ 3.6.0 | Progress and messages |
| Role | Name | Affiliation |
|---|---|---|
| Author, maintainer | Lucas Franรงa | Northumbria University, Circadia Lab |
| Author | Mario Leocadio-Miguel | Northumbria University, Circadia Lab |
- ๐ฑ ScoreMe โ the cross-platform app that administers questionnaires and generates the exports tallieR reads
- ๐ SleepDiaries โ the companion Sleep Diaries app for actigraphy and diary data collection
- ๐งช slumbR โ R companion for Sleep Diaries exports
- ๐ฌ circadia-bio โ the Circadia Lab GitHub organisation
Copyright ยฉ Lucas Franรงa, Mario Leocadio-Miguel, 2026
Released under the MIT License.
Note on third-party questionnaire instruments: The validated questionnaires supported by tallieR are the intellectual property of their respective authors and institutions. Their inclusion in this open-source package does not grant any rights to use them beyond what is permitted by each instrument's licence. It is the responsibility of the researcher to obtain any necessary permissions before use in a study.
