knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(DRSA) library(tibble) library(readxl)
In this vignette we give an introduction to creating information tables using the DRSA package. We consider a real-life dataset, the trial dataset, which contains footwear decision data. The examples and the description of the attributes is contained in an Excel file included in this package (inst/extdata/JS_DRSA_Trial_Key_and_Data_Table.xlsx
).
We start by reading the Input Data sheet of the Excel file into a data-frame. This sheet contains the examples of decisions. Each row consists of several attributes, including the object identifier and the decision made.
datasetPath = system.file("extdata", "JS_DRSA_Trial_Key_and_Data_Table.xlsx", package = "DRSA", mustWork = TRUE) decisionTable = readxl::read_excel(path = datasetPath, sheet = "Input_Data") #decisionTable$Q2 = factor(decisionTable$Q2, levels = 20:23, labels = c("Unsuitable", "Low", "Moderate", "High"), ordered = T) #decisionTable$QF4 = factor(decisionTable$QF4, levels = 31:33, labels = c("Easy", "Moderate", "Challenging"), ordered = T) decisionTable$Q3OD = factor(decisionTable$Q3OD, levels = c(0, 1, 2, 5), labels = c("Not evaluated", "Insufficient Detail", "Value for exclusion", "Value for association"), ordered = T) decisionTable$Q3PSO = factor(decisionTable$Q3PSO, levels = c(0, 1, 2, 5), labels = c("Not evaluated", "Insufficient Detail", "Value for exclusion", "Value for association"), ordered = T) decisionTable$Q3PSD = factor(decisionTable$Q3PSD, levels = c(0, 1, 2, 5), labels = c("Not evaluated", "Insufficient Detail", "Value for exclusion", "Value for association"), ordered = T) decisionTable$Q3OTHVAL = factor(decisionTable$Q3OTHVAL, levels = c(0, 1, 2, 5), labels = c("Not evaluated", "Insufficient Detail", "Value for exclusion", "Value for association"), ordered = T) decisionTable$QF2 = factor(decisionTable$QF2, levels = 8:9, labels = c("No", "Yes"), ordered = T) decisionTable$QF3ST = factor(decisionTable$QF3ST, levels = 8:9, labels = c("No", "Yes"), ordered = T) decisionTable$QF3PD = factor(decisionTable$QF3PD, levels = 8:9, labels = c("No", "Yes"), ordered = T) decisionTable$QF3IL = factor(decisionTable$QF3IL, levels = 8:9, labels = c("No", "Yes"), ordered = T) decisionTable$QF3ISP = factor(decisionTable$QF3ISP, levels = 8:9, labels = c("No", "Yes"), ordered = T) decisionTable$QF1 = factor(decisionTable$QF1, levels = 1:7, labels = c('Lacks sufficient detail', 'Exclusion', 'Indications of non-association', 'Limited association', 'Association of class', 'High degree of association', 'Identification'), ordered = T)
We continue by creating the meta-data of our dataset. It contains important details of the attributes in our dataset. The meta-data has to be provided as a data-frame containing one row for each attribute. Each row contains the name and type of the attribute, and in case of similarity attributes, the alpha- and beta-parameters of the similarity metric as well.
metaData = tribble( ~name, ~type, ~alpha, ~beta, 'OBJECT', 'object', NA, NA, 'UNAME', 'misc', NA, NA, 'QIMG', 'misc', NA, NA, 'KIMG', 'misc', NA, NA, 'Q1', 'similarity', 0.2, 0.0, 'Q2', 'similarity', 0.0, 1.0, 'Q3OD', 'dominance', NA, NA, 'Q3PSO', 'dominance', NA, NA, 'Q3PSD', 'dominance', NA, NA, 'Q3OTHVAL', 'dominance', NA, NA, 'Q3OTH_RESP', 'misc', NA, NA, 'QF2', 'indiscernibility', NA, NA, 'QF4', 'similarity', 0.0, 1.0, 'QF3ST', 'indiscernibility', NA, NA, 'QF3PD', 'indiscernibility', NA, NA, 'QF3IL', 'indiscernibility', NA, NA, 'QF3ISP', 'indiscernibility', NA, NA, 'QF1', 'decision', NA, NA )
Finally, we have everything we need to create an information table. We simply provide the decision table and the meta-data to the constructor of the InformationTable
class.
trialIT = InformationTable$new(decisionTable, metaData) save(trialIT, file = "../data/trialIT.RData")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.