Title: Easy Analysis and Visualization of Likert Scale Data
Version: 0.1.0
Description: Provides functions for summarizing, visualizing, and analyzing Likert-scale survey data. Includes support for computing descriptive statistics, Relative Importance Index (RII), reliability analysis (Cronbach's Alpha), and response distribution plots.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: ggplot2, stats, utils
NeedsCompilation: no
Packaged: 2025-03-29 18:14:56 UTC; ALIENWARE
Author: Mohammad Mollazehi [aut, cre]
Maintainer: Mohammad Mollazehi <mmolazehi@lu.edu.qa>
Repository: CRAN
Date/Publication: 2025-03-31 17:30:13 UTC

Cronbach Alpha for a set of ordinal items

Description

This function calculates the Cronbach Alpha for a set of ordinal items to assess their reliability or internal consistency.

Usage

cronbach_alpha(data)

Arguments

data

A data.frame with the ordinal items. Each column represents an item.

Value

The Cronbach alpha value as a numeric value between 0 and 1.


Barplot with RII annotation

Description

This function generates a barplot showing the distribution of responses for a single item, with the Relative Importance Index (RII) annotated.

Usage

plot_item(responses, max_scale = 5, scale_labels = NULL)

Arguments

responses

Numeric vector of ordinal responses.

max_scale

Max Likert scale value (default: 5).

scale_labels

Optional vector of labels for each scale point.

Value

A ggplot2 bar plot with RII annotation.

Examples

responses <- c(1, 2, 3, 4, 5, 3, 2, 1, NA)
plot_item(responses)

Rank items by RII or Mean

Description

This function ranks items in the data based on either the Relative Importance Index (RII) or the mean of responses.

Usage

rank_items(data, method = "rii", max_scale = 5, n = 5, top = TRUE)

Arguments

data

A data.frame of ordinal items.

method

Method to rank items. Either "rii" (for Relative Importance Index) or "mean" (for mean response).

max_scale

Max Likert scale value (default: 5).

n

Number of top items to return (default: 5).

top

Logical. If TRUE, returns the top items, otherwise returns the bottom items (default: TRUE).

Value

A vector of ranked items.


Weighted RII Calculation

Description

This function computes the weighted Relative Importance Index (RII) for a set of ordinal responses with associated weights.

Usage

rii_weighted(responses, weights, max_scale = 5)

Arguments

responses

Numeric vector of ordinal responses.

weights

Numeric vector of weights for each response.

max_scale

Max Likert scale value (default: 5).

Value

The weighted RII as a numeric value.


Summarize a Likert item

Description

This function calculates summary statistics for a Likert item, including mean, median, mode, and performs a chi-square test.

Usage

summarize(responses, max_scale = 5, exact = TRUE, B = 10000, tidy = FALSE)

Arguments

responses

Numeric vector of responses.

max_scale

The maximum scale value.

exact

If TRUE, use exact Monte Carlo method.

B

Number of simulations for Monte Carlo.

tidy

If TRUE, returns a tidy data frame.

Value

A list or data.frame with summary statistics.

Examples

responses <- c(1, 2, 3, 4, 5, 4, 3, 2, NA)
summarize(responses)

Create a tidy summary table of all items

Description

This function generates a tidy summary table for all ordinal items in a data.frame. The table includes statistics such as mean, median, standard deviation, counts, and percentages.

Usage

summary_table_all(data, max_scale = 5, scale_labels = NULL, decimals = 2)

Arguments

data

A data.frame of ordinal items.

max_scale

Max value on the Likert scale (default: 5).

scale_labels

Optional vector of labels for each scale point.

decimals

Number of decimal places for percentages (default: 2).

Value

A data.frame with summary statistics for all items.

Examples

dat <- data.frame(Q1 = c(1, 2, 3, 4, 5), Q2 = c(2, 2, 3, 4, NA))
summary_table_all(dat)