| Title: | Statistical Metrics and Reporting Tool |
|---|---|
| Description: | A 'Shiny'-based toolkit for item/test analysis. It is designed for multiple-choice, true-false, and open-ended questions. The toolkit is usable with datasets in 1-0 or other formats. Key analyses include difficulty, discrimination, response-option analysis, reports. The classical test theory methods used are described in Ebel & Frisbie (1991, ISBN:978-0132892314). |
| Authors: | Ahmet Çalışkan [aut, cre], Abdullah Faruk Kılıç [aut] |
| Maintainer: | Ahmet Çalışkan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3 |
| Built: | 2026-05-15 10:21:33 UTC |
| Source: | https://github.com/ahmetcaliskan1987/examly |
Generates a colored HTML badge for displaying values (like p-values or correlations) in the Shiny UI.
color_badge(v, type = c("generic", "p", "r"))color_badge(v, type = c("generic", "p", "r"))
v |
The numeric value to display. |
type |
The type of value ('generic', 'p', 'r') for coloring rules. |
An htmltools::span() object.
if (interactive()) { # Example for difficulty (p) color_badge(0.5, "p") # Example for discrimination (r) color_badge(0.2, "r") }if (interactive()) { # Example for difficulty (p) color_badge(0.5, "p") # Example for discrimination (r) color_badge(0.2, "r") }
Creates a vector of translation keys based on average difficulty (ap) and discrimination (ar).
comment_overall_keys(ap, ar)comment_overall_keys(ap, ar)
ap |
Average difficulty (p-value). |
ar |
Average discrimination (r-value). |
A character vector of translation keys.
comment_overall_keys(0.6, 0.35) # Medium, Keep comment_overall_keys(0.2, 0.15) # Hard, Removecomment_overall_keys(0.6, 0.35) # Medium, Keep comment_overall_keys(0.2, 0.15) # Hard, Remove
Finds the most frequent value (the mode) in a vector.
d_mode(x)d_mode(x)
x |
A vector. |
The mode of the vector. Returns NA if the vector is empty.
d_mode(c(1, 2, 2, 3, 3, 3, 4)) d_mode(c("a", "b", "a"))d_mode(c(1, 2, 2, 3, 3, 3, 4)) d_mode(c("a", "b", "a"))
Searches a vector of column names for common ID-related patterns.
detect_id_cols(cols)detect_id_cols(cols)
cols |
A character vector of column names. |
A character vector of names that matched the ID pattern.
detect_id_cols(c("Ad", "Soyad", "ogrenci no", "Madde1", "StudentID"))detect_id_cols(c("Ad", "Soyad", "ogrenci no", "Madde1", "StudentID"))
Returns a specific translation key based on an item's difficulty value.
difficulty_label_key(p)difficulty_label_key(p)
p |
A numeric item difficulty value. |
A character string (translation key).
difficulty_label_key(0.3) # Hard difficulty_label_key(0.7) # Medium difficulty_label_key(0.9) # Easydifficulty_label_key(0.3) # Hard difficulty_label_key(0.7) # Medium difficulty_label_key(0.9) # Easy
Returns a specific translation key based on an item's discrimination value.
discrimination_decision_key(r)discrimination_decision_key(r)
r |
A numeric item discrimination value. |
A character string (translation key).
discrimination_decision_key(0.15) # Remove discrimination_decision_key(0.25) # Consider discrimination_decision_key(0.4) # Keepdiscrimination_decision_key(0.15) # Remove discrimination_decision_key(0.25) # Consider discrimination_decision_key(0.4) # Keep
Tries to get the default quant argument from psychometric::item.exam.
Returns 0.27 if the package is not installed or an error occurs.
get_itemexam_quant()get_itemexam_quant()
A numeric value for the quantile (default 0.27).
get_itemexam_quant()get_itemexam_quant()
Finds <lang>.json under the installed package's i18n/ folder and,
if not found (during development), falls back to inst/i18n/<lang>.json.
i18n_load(lang = "tr")i18n_load(lang = "tr")
lang |
Character scalar language code. Currently |
A named list (key -> string) parsed from the JSON file.
# Always-fast: locate the installed TR dictionary (empty string if not installed) system.file("shinyapp", "i18n", "tr.json", package = "examly") # Safe example that runs only if the file actually exists p <- system.file("shinyapp", "i18n", "tr.json", package = "examly") if (nzchar(p) && file.exists(p)) { d <- i18n_load("tr") i18n_t(d, "ui.title", "Baslik") }# Always-fast: locate the installed TR dictionary (empty string if not installed) system.file("shinyapp", "i18n", "tr.json", package = "examly") # Safe example that runs only if the file actually exists p <- system.file("shinyapp", "i18n", "tr.json", package = "examly") if (nzchar(p) && file.exists(p)) { d <- i18n_load("tr") i18n_t(d, "ui.title", "Baslik") }
Returns the value for key from a dictionary produced by i18n_load().
If the key is missing, returns default when provided, otherwise the key itself.
i18n_t(dict, key, default = NULL)i18n_t(dict, key, default = NULL)
dict |
Named list produced by |
key |
Character scalar; lookup key. |
default |
Optional fallback value if the key is not present. |
Character scalar.
# A quick, fully automatic check: p <- system.file("shinyapp", "i18n", "en.json", package = "examly") if (nzchar(p) && file.exists(p)) { d <- i18n_load("en") i18n_t(d, "buttons.download", "Download") }# A quick, fully automatic check: p <- system.file("shinyapp", "i18n", "en.json", package = "examly") if (nzchar(p) && file.exists(p)) { d <- i18n_load("en") i18n_t(d, "buttons.download", "Download") }
Detects if a vector (after removing NAs) contains only 0 and 1.
is_scored_01(vec)is_scored_01(vec)
vec |
The vector to check. |
TRUE if the vector is 0/1 scored, FALSE otherwise.
is_scored_01(c(1, 0, 1, 0, NA)) is_scored_01(c(1, 0, 2, 0)) is_scored_01(c("A", "B", "C"))is_scored_01(c(1, 0, 1, 0, NA)) is_scored_01(c(1, 0, 2, 0)) is_scored_01(c("A", "B", "C"))
Calculates the Kuder-Richardson 20 (KR-20) reliability coefficient for a data.frame or matrix of dichotomous (0/1) items.
kr20(m)kr20(m)
m |
A data.frame or matrix where rows are subjects and columns are dichotomously scored (0/1) items. |
A numeric value for the KR-20 coefficient, or NA_real_ if calculation is not possible.
item_matrix <- data.frame( m1 = c(1, 1, 0, 1), m2 = c(1, 0, 1, 1), m3 = c(0, 1, 0, 0) ) kr20(item_matrix)item_matrix <- data.frame( m1 = c(1, 1, 0, 1), m2 = c(1, 0, 1, 1), m3 = c(0, 1, 0, 0) ) kr20(item_matrix)
A helper function that takes a mixed character vector or a single semi-colon/comma-separated string and returns a clean character vector of column names.
norm_cols(x)norm_cols(x)
x |
A character vector or a single string containing column names. |
A character vector of trimmed, non-empty column names.
norm_cols(" m1 , m2;m3") norm_cols(c(" m1 ", "m2", "", " m3 "))norm_cols(" m1 , m2;m3") norm_cols(c(" m1 ", "m2", "", " m3 "))
Cleans and validates a vector of characters, keeping only standard letter grades (A, B, C, D, E).
norm_letter(x)norm_letter(x)
x |
A vector, typically character. |
A character vector of normalized grades (A-E) or NA.
norm_letter(c(" a ", "B", "c", "F", "d", NA))norm_letter(c(" a ", "B", "c", "F", "d", NA))
Validates that a vector contains only 1s, 0s, or NAs.
parse_lc_bin(x)parse_lc_bin(x)
x |
A vector of potential 1/0 scores. |
An integer vector (1, 0, or NA).
parse_lc_bin(c(1, 0, "1", "0", 2, "A", NA))parse_lc_bin(c(1, 0, "1", "0", 2, "A", NA))
Cleans a vector of potential scores, converting to numeric and removing invalid or out-of-range values.
parse_lc_raw(x)parse_lc_raw(x)
x |
A vector (typically character) of raw scores. |
A numeric vector of cleaned scores.
parse_lc_raw(c("10", "5.5", "0", "-2", "ikiyüz", NA, "1000001"))parse_lc_raw(c("10", "5.5", "0", "-2", "ikiyüz", NA, "1000001"))
Scores a Multiple Choice (A-E) response vector against a key.
parse_mc_bin(x, key)parse_mc_bin(x, key)
x |
A vector of student responses. |
key |
The correct answer key (e.g., "A", "B"). |
An integer vector (1=correct, 0=wrong, NA=invalid).
parse_mc_bin(c("a", "B", "c", "F", " b "), key = "B")parse_mc_bin(c("a", "B", "c", "F", " b "), key = "B")
Scores a True/False (Doğru/Yanlış) response vector against a key.
parse_tf_bin(x, key)parse_tf_bin(x, key)
x |
A vector of student responses. |
key |
The correct answer key (e.g., "D", "Y", "TRUE", "FALSE"). |
An integer vector (1=correct, 0=wrong, NA=invalid).
parse_tf_bin(c("D", "Y", "DOGRU", "False", "Belki"), key = "D")parse_tf_bin(c("D", "Y", "DOGRU", "False", "Belki"), key = "D")
Calculates the correlation between a single item's score and the rest of the total score.
pbiserial_rest(item, rest)pbiserial_rest(item, rest)
item |
A numeric vector of dichotomous item scores (0/1). |
rest |
A numeric vector of the total scores, excluding the item. |
The point-biserial correlation coefficient.
item1 <- c(1, 0, 1, 0, 1, 1) rest_score <- c(10, 8, 12, 5, 9, 11) pbiserial_rest(item1, rest_score)item1 <- c(1, 0, 1, 0, 1, 1) rest_score <- c(10, 8, 12, 5, 9, 11) pbiserial_rest(item1, rest_score)
A simple helper to calculate the inverse of the p-value (difficulty index).
q_index(p)q_index(p)
p |
A numeric value or vector (item difficulty). |
A numeric value or vector (1 - p).
q_index(0.8) q_index(c(0.2, 0.5, 0.7))q_index(0.8) q_index(c(0.2, 0.5, 0.7))
Launches the packaged Shiny app located in inst/shinyapp.
If the app files are not found, a minimal placeholder app is launched instead.
run_app()run_app()
This function is exported so users can run examly::run_app().
Invisibly returns NULL. Called for its side effects.
system.file("shinyapp", package = "examly") if(interactive()){ examly::run_app() }system.file("shinyapp", package = "examly") if(interactive()){ examly::run_app() }
Calculates the total number of correct, incorrect, and missing answers for each student (row).
student_counts(sc)student_counts(sc)
sc |
A data.frame of scored items (0=wrong, 1=correct, NA=missing). |
A tibble with columns Dogru, Yanlis, and Bos.
score_df <- data.frame(m1 = c(1, 0, 1), m2 = c(0, 1, NA), m3 = c(1, 1, 1)) student_counts(score_df)score_df <- data.frame(m1 = c(1, 0, 1), m2 = c(0, 1, NA), m3 = c(1, 1, 1)) student_counts(score_df)