## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, message=FALSE, warning=FALSE--------------------------------------
library(rankingQ)
data(identity)

## -----------------------------------------------------------------------------
recover_recorded_responses(
  presented_order = "app_identity_row_rnd",
  true_order = "app_identity",
  df = head(identity[, c("app_identity", "app_identity_row_rnd")], 10)
)

## Alternatively, for the first respondent
recover_recorded_responses(
  presented_order = "2143",
  true_order = "1423",
)

## -----------------------------------------------------------------------------
uniformity_test(identity, "app_identity")

## -----------------------------------------------------------------------------
## Correctly answered the anchor question
tab <- table(
  identity$anc_identity_recorded[identity$anc_correct_identity == 1]
)
round(prop.table(tab) * 100, digits = 1)
uniformity_test(tab)

## Incorrectly answered the anchor question
tab <- table(
  identity$anc_identity_recorded[identity$anc_correct_identity == 0]
)
round(prop.table(tab) * 100, digits = 1)
uniformity_test(tab)

## -----------------------------------------------------------------------------
tab <- table(head(identity$app_identity_recorded))
tab ## only five patterns out of twenty-four possible patterns
permn_augment(tab)

