| Type: | Package |
| Title: | Garrett Ranking Analysis and Visualization |
| Version: | 0.1.5 |
| Description: | Performs Garrett ranking analysis of respondent-ranked items such as constraints, problems, factors, or priorities. The package converts respondent rankings into Garrett scores, calculates mean Garrett scores and final ranks and provides methods for summarizing,tabulating and visualizing ranking results. It also provides Kendall's coefficient of concordance for assessing the degree of agreement among respondents. Garrett ranking does not accommodate tied ranks and Kendall's coefficient of concordance is likewise computed for untied ranking data.For more details see Garrett and Woodworth (1969) https://books.google.com/books?id=aoqSmQEACAAJ and Buragohain and Dubey (2021) <doi:10.5958/2454-552X.2021.00055.4>. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Imports: | ggplot2, pheatmap, rlang |
| Suggests: | readxl, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Depends: | R (≥ 3.5) |
| LazyData: | true |
| NeedsCompilation: | no |
| Packaged: | 2026-09-26 03:11:27 UTC; bejoy |
| Author: | Blesson B. Varghese [aut, cre], Adarsh V S [aut], Bhavana Sajeev [aut], Azhanuo Rutsa [aut], Joe Shiney M A [aut] |
| Maintainer: | Blesson B. Varghese <blessonvarghese1234@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-10-06 16:40:08 UTC |
Validate Garrett Ranking Data
Description
Validates respondent ranking data before Garrett ranking analysis. The function checks the input data structure, ranking values, and completeness of ranks for each respondent. Supported input formats include data frames, matrices, CSV files, and Excel files.
Usage
.validate_ranking_data(data, respondent = NULL)
Arguments
data |
A data.frame, matrix, CSV file path, or Excel file path containing respondent ranking data. Each row represents a respondent and each column represents a factor or item being ranked. |
respondent |
Optional respondent ID column name or column position to exclude from the ranking data before validation. |
Value
A validated data frame containing the ranking data after checking that the data have valid dimensions, numeric integer ranks, and that each respondent assigns every rank exactly once.
#Example Dataset for Garrett Ranking
Description
#Example Dataset for Garrett Ranking
Usage
garrett_example
Format
A data frame with 50 rows and 23 columns:
- Respondent
The name or serial number identifying each respondent.
- C1
Rank assigned to constraint 1.
- C2
Rank assigned to constraint 2.
- C3
Rank assigned to constraint 3.
- C4
Rank assigned to constraint 4.
- C5
Rank assigned to constraint 5.
- C6
Rank assigned to constraint 6.
- C7
Rank assigned to constraint 7.
- C8
Rank assigned to constraint 8.
- C9
Rank assigned to constraint 9.
- C10
Rank assigned to constraint 10.
- C11
Rank assigned to constraint 11.
- C12
Rank assigned to constraint 12.
- C13
Rank assigned to constraint 13.
- C14
Rank assigned to constraint 14.
- C15
Rank assigned to constraint 15.
- C16
Rank assigned to constraint 16.
- C17
Rank assigned to constraint 17.
- C18
Rank assigned to constraint 18.
- C19
Rank assigned to constraint 19.
- C20
Rank assigned to constraint 20.
- C21
Rank assigned to constraint 21.
- C22
Rank assigned to constraint 22.
Details
The first column contains the respondent's name or serial number. The remaining 22 columns (C1 to C22) contain the ranks assigned by each respondent to the corresponding constraints. There are 50 respondents in the dataset. No tied ranks are present in the dataset.
An example dataset demonstrating the application of the Garrett ranking method.
The dataset contains ranking responses from 50 respondents for 22 constraints.
Examples
data(garrett_example)
#Run Garrett ranking analysis
result <- garrett_rank(garrett_example,respondent = "Respondent")
summary(result)
result$ranking
result$frequency
result$weighted_scores
#Select the plot type
plot(result, type = "bar")
plot(result, type = "lollipop")
plot(result, type = "dot")
plot(result, type = "line")
plot(result, type = "heatmap")
plot(result, type = "cluster")
plot(result,type="contribution")
plot(result, type = "cluster", k = 3)
plot(result,type = "cluster",scale = "row",show_numbers = TRUE)
#Run Kendall's Coefficient of Concordance
kw<-kendall_w(garrett_example,respondent = "Respondent")
summary(kw)
Garrett Ranking Analysis
Description
Performs Garrett ranking analysis on respondent ranking data.
Usage
garrett_rank(data, respondent = NULL)
Arguments
data |
A data.frame, matrix, CSV file path or Excel file path containing ranking data. |
respondent |
Optional respondent ID column name or column position to exclude before analysis. |
Details
Each row must represent one respondent and each column one factor, constraint, or item. Each respondent must assign every rank from 1 to the number of factors exactly once.
Value
An object of class "garrett", which is a list containing:
- ranking
A data.frame containing the factor names, mean Garrett scores, and final ranks.
Mean_Scoreis the average Garrett score for each factor across all respondents. Higher mean Garrett scores indicate higher overall priority, andRank = 1represents the highest-ranked factor.- frequency
A data.frame containing the number of respondents assigning each possible rank to each factor, together with the corresponding percent positions and Garrett scores.
- weighted_scores
A numeric matrix containing the rank frequencies multiplied by their corresponding Garrett scores. These values are used to calculate the mean Garrett score for each factor.
- reference
A data.frame containing the standard Garrett conversion table used to convert percent positions into Garrett scores.
- respondents
An integer giving the number of respondents included in the analysis.
- factors
An integer giving the number of factors ranked by the respondents.
- factor_names
A character vector containing the names of the ranked factors.
- call
The matched function call used to create the object.
Examples
result <- garrett_rank(garrett_example,respondent = "Respondent")
summary(result)
result$ranking
result$frequency
result$weighted_scores
Garrett Conversion Table It is a standard Garrett conversion table used by the package.
Description
Garrett Conversion Table It is a standard Garrett conversion table used by the package.
Usage
garrett_table()
Value
A data.frame with two columns:
- Percent_Position
The percent position values used to determine Garrett scores from respondent ranks.
- Garrett_Score
The corresponding Garrett scores assigned to the percent positions.
Examples
table<-garrett_table()
print(table)
Kendall's Coefficient of Concordance
Description
Computes Kendall's coefficient of concordance (W) for complete, untied ranking data.
Usage
kendall_w(data, respondent = NULL)
Arguments
data |
A data.frame, matrix, CSV file path, or Excel file path containing ranking data. |
respondent |
Optional respondent ID column name or column position to exclude before analysis. |
Details
Each row must represent one respondent and each column one factor. Each respondent must assign every rank from 1 to the number of factors exactly once. Tied ranks are not supported.
Value
An object of class "kendall_w", which is a list containing:
- statistic
Kendall's coefficient of concordance (W), ranging from 0 to 1, where larger values indicate stronger agreement among respondents.
- chisq
The chi-square statistic used to test the statistical significance of the concordance.
- df
Degrees of freedom for the chi-square test.
- p.value
The p-value associated with the chi-square test.
- respondents
The number of respondents included in the analysis.
- factors
The number of ranked factors.
- rank_sum
A named numeric vector containing the sum of ranks assigned to each factor across respondents.
- call
The matched function call.
Examples
data(garrett_example)
kw <- kendall_w(garrett_example,respondent = "Respondent")
kw
summary(kw)
Plot Garrett Ranking Results
Description
Produces graphical representations of Garrett ranking results.
Usage
## S3 method for class 'garrett'
plot(
x,
type = c("bar", "lollipop", "dot", "line", "heatmap", "cluster", "contribution"),
top = NULL,
color = "#2C7FB8",
label = TRUE,
point_size = 3,
line_size = 1,
cluster_rows = TRUE,
cluster_cols = FALSE,
distance = "euclidean",
clustering_method = "complete",
scale = "none",
show_numbers = FALSE,
...
)
Arguments
x |
An object of class |
type |
Type of plot. Options are |
top |
Number of top-ranked factors to display. Default is |
color |
Colour used for ranking plots. |
label |
Logical. Should Garrett scores be displayed as labels? |
point_size |
Size of points used in dot, lollipop, and line plots. |
line_size |
Width of lines used in lollipop and line plots. |
cluster_rows |
Logical. Should factors be hierarchically clustered in cluster plots? |
cluster_cols |
Logical. Should ranks be hierarchically clustered? |
distance |
Distance measure used for hierarchical clustering. |
clustering_method |
Method used for hierarchical clustering. |
scale |
Should heatmap data be scaled by rows, columns, or not
scaled? Options are |
show_numbers |
Logical. Should matrix values be displayed inside heatmap cells? |
... |
Additional arguments passed to |
Value
For "bar", "lollipop", "dot", and
"line" plots, a ggplot object. For "heatmap",
"cluster", and "contribution" plots, a pheatmap
object returned invisibly. The returned object contains the graphical
representation of the Garrett ranking results.
Examples
data(garrett_example)
result <- garrett_rank(garrett_example,respondent = "Respondent")
#Select the plot type
plot(result, type = "bar")
plot(result, type = "lollipop")
plot(result, type = "dot")
plot(result, type = "line")
plot(result, type = "heatmap")
plot(result, type = "cluster")
plot(result,type="contribution")
plot(result, type = "cluster", k = 3)
plot(result,type = "cluster",scale = "row",show_numbers = TRUE)