---
title: "VoiceR Saved Report"
output: html_document
params:
  audioData: NA
  comparisons: NA
  normalPlots: NA
  includeDimensions: NA
  avoidNormalCheck: NA
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


```{r message=FALSE, warning=FALSE, include=FALSE}
createNormalityText <- function(audioData, measure, nameMeasure, includeDimensions = FALSE, avoidNormalCheck = FALSE, BoxCoxConstant = FALSE){
  if(sum(!is.na(audioData[,measure])) < 3){
    return("All values are NA.")
  }
  
  
  normalityData <- tableNormality(audioData, measure, includeDimensions = includeDimensions)
  if(is.character(normalityData)){
    text <- normalityData
  }
  
  NOTnormal <- normalityData$pValue[1] < 0.05
  if(min(normalityData$pValue)<0.05 & avoidNormalCheck){
    text <- ifelse(nrow(normalityData) > 1, paste0("Box-Cox Procedure was used to transform ", nameMeasure, " to follow a more normal distribution. ", ifelse(BoxCoxConstant != FALSE, paste0("In order to apply Box-Cox transformation to ", nameMeasure, " a constat equal to ", BoxCoxConstant, " was added to it in order to make it positive."), "")), paste0("
Tukey Ladder of Powers was used to transform ", nameMeasure, " to follow a more normal distribution. "))
  }
  else{
    text <- ""
  }
  
  
  if(nrow(audioData) > 3){
    if(NOTnormal){
      text <- paste0(text, "A Shapiro-Wilk test showed a significant departure from normality for the ", nameMeasure, " measure, W(", normalityData$N[1], ") = ", normalityData$W[1], ", ",  ifelse(normalityData$pValue[1] < 0.001, "p < .001", ifelse(normalityData$pValue[1] < 0.01, "p < .01", ifelse(normalityData$pValue[1] < 0.05, "p < .05", paste("p = ", round(normalityData$pValue[1], 2))))), ".")
      if("Condition" %in% colnames(audioData)){
        if(any(normalityData[-1,]$pValue > 0.05)){
          text2 <- "Although, a Shapiro-Wilk test did not show a significant departure from normality "
          for (i in (which(normalityData[-1,]$pValue > 0.05) + 1)) {
            text2 <- paste0(text2,"for ", normalityData$Condition[i],  " condition", ", W(", normalityData$N[i], ") = ", normalityData$W[i], ", ",  ifelse(normalityData$pValue[i] < 0.001, "p < .001", ifelse(normalityData$pValue[i] < 0.01, "p < .01", ifelse(normalityData$pValue[i] < 0.05, "p < .05", paste("p = ", round(normalityData$pValue[i],2))))))
            if(length(which(normalityData[-1,]$pValue > 0.05) + 1) > 1){
              if(i >= (which(normalityData[-1,]$pValue > 0.05) + 1)[1] & i < (which(normalityData[-1,]$pValue > 0.05) + 1)[length(which(normalityData[-1,]$pValue > 0.05) + 1) - 1]){
                text2 <- paste0(text2, "; ")
              }
              else if(i == (which(normalityData[-1,]$pValue > 0.05) + 1)[length(which(normalityData[-1,]$pValue > 0.05) + 1)-1]){
                text2 <- paste0(text2, " and ")
              }
            }
            
            
          }
          text <- paste0(text, " ", text2, ".")
        }
      }
      
      
    }else{
      text <- paste0(text, "A Shapiro-Wilk test did not show a significant departure from normality for the ", nameMeasure, " measure, W(", normalityData$N[1], ") = ", normalityData$W[1], ", ",  ifelse(normalityData$pValue[1] < 0.001, "p < .001", ifelse(normalityData$pValue[1] < 0.01, "p < .01", ifelse(normalityData$pValue[1] < 0.05, "p < .05", paste("p = ", round(normalityData$pValue[1], 2))))), ".")
      if("Condition" %in% colnames(audioData)){
        if(any(normalityData[-1,]$pValue < 0.05)){
          text2 <- "Although, a Shapiro-Wilk test showed a significant departure from normality "
          for (i in (which(normalityData[-1,]$pValue < 0.05) + 1)) {
            text2 <- paste0(text2,"for ", normalityData$Condition[i],  " condition", ", W(", normalityData$N[i], ") = ", normalityData$W[i], ", ",  ifelse(normalityData$pValue[i] < 0.001, "p < .001", ifelse(normalityData$pValue[i] < 0.01, "p < .01", ifelse(normalityData$pValue[i] < 0.05, "p < .05", paste("p = ", round(normalityData$pValue[i], 2))))))
            if(length(which(normalityData[-1,]$pValue < 0.05) + 1) > 1){
              if(i >= (which(normalityData[-1,]$pValue > 0.05) + 1)[1] & i < (which(normalityData[-1,]$pValue < 0.05) + 1)[length(which(normalityData[-1,]$pValue < 0.05) + 1)-1]){
                text2 <- paste0(text2, "; ")
              }
              else if(i == (which(normalityData[-1,]$pValue < 0.05) + 1)[length(which(normalityData[-1,]$pValue < 0.05) + 1)-1]){
                text2 <- paste0(text2, " and ")
              }
            }
            
            
          }
          text <- paste0(text, " ", text2, ".")
        }
      }
    }
  }
  return(text)
}

```



```{r message=FALSE, warning=FALSE, include=FALSE}
createComparisonText <- function(audioData, measure, nameMeasure, includeDimensions = FALSE, avoidNormalCheck = FALSE){
  if(sum(!is.na(audioData[,measure])) < 3){
    return("All values are NA.")
  }  
  normalityData <- tableNormality(audioData, measure, includeDimensions)

  
  if("Condition" %in% colnames(audioData) & !includeDimensions){
      
      if(length(unique(audioData$Condition)) > 2){
        
        if(min(normalityData$pValue)<0.05 & !avoidNormalCheck){
          
          kruskalTestData <- kruskal.test(as.formula(paste0(measure, "~", "Condition")), audioData)
          audioData$VarRank <- rank(audioData[,measure], ties.method = "average")
          dunnData <- FSA::dunnTest(as.formula(as.formula(paste0(measure, "~", "Condition"))), data = audioData)
          dunnData$res$Comparison <- stringr::str_replace(dunnData$res$Comparison, "-", "and")
          text2 <- ""
          
          for(conditionNumber in 1:length(unique(audioData$Condition))){
            
            text2 <- paste0(text2, round(mean(audioData[audioData$Condition == unique(audioData$Condition)[conditionNumber],"VarRank"]),2), " for ", unique(audioData$Condition)[conditionNumber])
            
            if(length(unique(audioData$Condition)) > 1 & conditionNumber < length(unique(audioData$Condition)) - 1){
              text2 <- paste0(text2, ", ")
            }
            
            else if(length(unique(audioData$Condition)) > 1 & conditionNumber == length(unique(audioData$Condition)) - 1){
              text2 <- paste0(text2, " and ")
            }
            
            else{
              text2 <- paste0(text2, ".")
            }
          }
        
          if(kruskalTestData$p.value < 0.05){
            
              text <- paste0("A Kruskal-Wallis H test showed that there was a statistically significant difference in audios ", nameMeasure, " between the different conditions, X²(", round(kruskalTestData$parameter, 2), ") = ", round(kruskalTestData$statistic, 2), ", ", ifelse(kruskalTestData$p.value < 0.001, "p < .001", ifelse(kruskalTestData$p.value < 0.01, "p < .01", ifelse(kruskalTestData$p.value < 0.05, "p < .05", paste("p = ", round(kruskalTestData$p.value, 2))))), ", with a mean rank ", nameMeasure, " of ", text2)
              
             if(any(dunnData$res$P.adj < 0.05)){
                text <- paste0(text, " Post hoc comparisons using the Dunn's Test showed significant differences in ", nameMeasure, "'s mean rank between ")
                
                for (i in 1:nrow(dunnData$res[dunnData$res$P.adj < 0.05,])) {
                  if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1 & i < nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                  text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ")" ,", ")
              }
              else if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1  & i == nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ") " , " and ")
              }
              else{
                text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", round(paste("p = ", dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ")" , ".")
              }
            
              }
              if(any(dunnData$res$P.adj > 0.05)){
                  text <- paste0(text, " However, no significant differences were found between ")
                for (i in 1:nrow(dunnData$res[dunnData$res$P.adj > 0.05,])) {
                  if(nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) > 1 & i < nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) - 1){
                  text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i], 2))))) , ")" ,", ")
                }
                  else if(nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) > 1  & i == nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) - 1){
                    text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i], 2))))), ") " , "and ")
                  }
                  else{
                    text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[i], 2))))), ")" , " conditions.")
                  }
                }
              }
            }
          }
          else{
            text <- paste0("A Kruskal-Wallis H test did not show that there was a statistically significant difference in audios ", nameMeasure, " between the different conditions, X²(", round(kruskalTestData$parameter, 2), ") = ", round(kruskalTestData$statistic, 2), ", ", ifelse(kruskalTestData$p.value < 0.001, "p < .001", ifelse(kruskalTestData$p.value < 0.01, "p < .01", ifelse(kruskalTestData$p.value < 0.05, "p < .05", paste("p = ", round(kruskalTestData$p.value, 2))))), ", with a mean rank ", nameMeasure, " of ", text2)
            
            if(any(dunnData$res$P.adj < 0.05)){
              text <- paste0(text, " However, significant differences were found between ")
              for (i in 1:nrow(dunnData$res[dunnData$res$P.adj < 0.05,])) {
                if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1 & i < nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ")" ,", ")
              }
              else if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1  & i == nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ") " , " and ")
              }
              else{
                text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[i], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[i], 2))))), ")" , ".")
              }
              
              }
      
              }
          }
        
        }
        else{
          AnovaTestData <- summary(aov(as.formula(paste0(measure, "~", "Condition")), audioData))
          tukeyData <- TukeyHSD(aov(as.formula(paste0(measure, "~", "Condition")), data = audioData))
          tukeyData <- as.data.frame(tukeyData$Condition)
          tukeyData$group1 <- stringr::str_split(rownames(tukeyData), "-", simplify = T)[,1]
          tukeyData$group2 <- stringr::str_split(rownames(tukeyData), "-", simplify = T)[,2]
          rownames(tukeyData) <- stringr::str_replace(rownames(tukeyData), "-", " and ")
          
          
          if(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.05){
            text <- paste0("An analysis of variance (ANOVA) on ", nameMeasure, " yielded significant variation among conditions, F(", AnovaTestData[[1]]["Condition",]$Df, ", ", AnovaTestData[[1]]["Residuals",]$Df, ") = ", round(AnovaTestData[[1]]["Condition",]$`F value`, 2), ", ", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.001, "p < .001", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.01, "p < .01", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.05, "p < .05", paste("p = ", round(AnovaTestData[[1]]["Condition",]$`Pr(>F)`, 2))))), ".")
            if(any(tukeyData$`p adj` < 0.05)){
            for (i in 1:nrow(tukeyData)) {
              tukeyData$mean1[i] <- mean(audioData[audioData$Condition == tukeyData$group1[i], measure], na.rm = TRUE)
              tukeyData$mean2[i] <- mean(audioData[audioData$Condition == tukeyData$group2[i], measure], na.rm = TRUE)
              tukeyData$comparison[i] <- ifelse(tukeyData$mean1[i] > tukeyData$mean2[i], "greater", ifelse(tukeyData$mean1[i] == tukeyData$mean2[i], "equal", "smaller"))
              tukeyData$sd1[i] <- sd(audioData[audioData$Condition == tukeyData$group1[i], measure], na.rm = TRUE)
              tukeyData$sd2[i] <- sd(audioData[audioData$Condition == tukeyData$group2[i], measure], na.rm = TRUE)
            }
            
            
            text <- paste0(text, " Post hoc comparisons using the Tukey HSD Test indicated that ")
            for (i in 1:nrow(tukeyData[tukeyData$`p adj` < 0.05,])) {
              if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1 & i < nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
                text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", ", ")
              }
              else if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1  & i == nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
                text <- paste0(text," ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", " and ")
              }
              else{
                text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", ".")
              }
            
            }
          }
            if(any(tukeyData$`p adj` > 0.05)){
              text <- paste0(text, " However, no significant differences were found between ")
            for (i in 1:nrow(tukeyData[tukeyData$`p adj` > 0.05,])) {
              if(nrow(tukeyData[tukeyData$`p adj` > 0.05,]) > 1 & i < nrow(tukeyData[tukeyData$`p adj` > 0.05,]) - 1){
              text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i], 2))))) , ")" ,", ")
            }
            else if(nrow(tukeyData[tukeyData$`p adj` > 0.05,]) > 1  & i == nrow(tukeyData[tukeyData$`p adj` > 0.05,]) - 1){
              text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i], 2))))) , ") " , " and ")
            }
            else{
              text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[i], 2))))) , ")" , " conditions.")
            }
          }
        
        
          }
        }
        else{
          text <-  paste0("An analysis of variance (ANOVA) on ", nameMeasure, " did not yield significant variation among conditions, F(", AnovaTestData[[1]]["Condition",]$Df, ", ", AnovaTestData[[1]]["Residuals",]$Df, ") = ", round(AnovaTestData[[1]]["Condition",]$`F value`, 2), ", ", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.001, "p < .001", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.01, "p < .01", ifelse(AnovaTestData[[1]]["Condition",]$`Pr(>F)` < 0.05, "p < .05", paste("p = ", round(AnovaTestData[[1]]["Condition",]$`Pr(>F)`, 2))))), ".")
          
                  if(any(tukeyData$`p adj` < 0.05)){
          for (i in 1:nrow(tukeyData)) {
            tukeyData$mean1[i] <- mean(audioData[audioData$Condition == tukeyData$group1[i], measure])
            tukeyData$mean2[i] <- mean(audioData[audioData$Condition == tukeyData$group2[i], measure])
            tukeyData$comparison[i] <- ifelse(tukeyData$mean1[i] > tukeyData$mean2[i], "greater", ifelse(tukeyData$mean1[i] == tukeyData$mean2[i], "equal", "smaller"))
            tukeyData$sd1[i] <- sd(audioData[audioData$Condition == tukeyData$group1[i], measure])
            tukeyData$sd2[i] <- sd(audioData[audioData$Condition == tukeyData$group2[i], measure])
          }
          
          
          text <- paste0(text, " However, post hoc comparisons using the Tukey HSD Test indicated that ")
          for (i in 1:nrow(tukeyData[tukeyData$`p adj` < 0.05,])) {
            if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1 & i < nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
            text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", ", ")
          }
          else if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1  & i == nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
            text <- paste0(text," ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", " and ")
          }
          else{
            text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[i], " condition",  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[i], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[i], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[i], 2))))), ")", " than in the ", tukeyData$group2[i], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[i] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[i], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[i], 2), ")", ".")
          }
          
          }
          }
  
          
        }
      }
      }
      else if(length(unique(audioData$Condition)) == 2){
        if(min(normalityData$pValue)<0.05 & !avoidNormalCheck){
          WilcoxonResults <- wilcox.test(as.formula(paste0(measure, "~", "Condition")), audioData)
          audioData$VarRank <- rank(audioData[,measure], ties.method = "average")
          SummaryData <- data.frame(condition1 = unique(audioData$Condition)[1], condition2 = unique(audioData$Condition)[2], meanRank1 = round(mean(audioData[audioData$Condition == unique(audioData$Condition)[1],"VarRank"]),2), meanRank2 = round(mean(audioData[audioData$Condition == unique(audioData$Condition)[2],"VarRank"]),2), comparison = NA)
          if(WilcoxonResults$p.value < 0.05){
            SummaryData$comparison <- ifelse(SummaryData$meanRank1 > SummaryData$meanRank2, "higher", "lower")
            text <- paste0("A Wilcoxon Signed-Ranks Test indicated that ", nameMeasure, " mean rank was significantly ", SummaryData$comparison, " for ", SummaryData$condition1, " condition (Mean Rank = ", round(SummaryData$meanRank1, 2), ")" , " than ", SummaryData$condition2, " condition ", "(Mean Rank = ", round(SummaryData$meanRank2, 2), "), ", "Z = ", round(qnorm(WilcoxonResults$p.value/2), 2), ", ", ifelse(WilcoxonResults$p.value < 0.001, "p < .001", ifelse(WilcoxonResults$p.value < 0.01, "p < .01", ifelse(WilcoxonResults$p.value < 0.05, "p < .05", paste("p = ", round(WilcoxonResults$p.value, 2))))))
          }
          else{
            text <- paste0("A Wilcoxon Signed-Ranks Test did not show significant differences between ",  SummaryData$condition1, " condition (Mean Rank = ", round(SummaryData$meanRank1, 2), ")" , " and ", SummaryData$condition2, " condition ", "(Mean Rank = ", round(SummaryData$meanRank2, 2), "), ", "Z = ", round(qnorm(WilcoxonResults$p.value/2), 2), ", ", ifelse(WilcoxonResults$p.value < 0.001, "p < .001", ifelse(WilcoxonResults$p.value < 0.01, "p < .01", ifelse(WilcoxonResults$p.value < 0.05, "p < .05", paste("p = ", round(WilcoxonResults$p.value, 2))))))
          }
          
        }
        else{
          ttestResults <- t.test(as.formula(paste0(measure, "~", "Condition")), audioData)
          SummaryData <- data.frame(condition1 = unique(audioData$Condition)[1], condition2 = unique(audioData$Condition)[2], mean1 = round(mean(audioData[audioData$Condition == unique(audioData$Condition)[1],measure]),2), mean2 = round(mean(audioData[audioData$Condition == unique(audioData$Condition)[2],measure]),2), sd1 = round(sd(audioData[audioData$Condition == unique(audioData$Condition)[1],measure]),2), sd2 = round(mean(audioData[audioData$Condition == unique(audioData$Condition)[2],measure]),2), comparison = NA)
          
          if(ttestResults$p.value < 0.05){
            SummaryData$comparison <- ifelse(SummaryData$mean1 > SummaryData$mean2, "higher", "lower")
            text <- paste0("A T-Test indicated that ", nameMeasure," was significantly ", SummaryData$comparison, " for ", SummaryData$condition1, " condition (Mean = ", round(SummaryData$mean1, 2), ", SD = ", round(SummaryData$sd1, 2), ")" , " than ", SummaryData$condition2, " condition ", "(Mean = ", round(SummaryData$mean2, 2), ", SD = ", round(SummaryData$sd2, 2) ,"), ", "Z = ", round(qnorm(ttestResults$p.value/2), 2), ", ", ifelse(ttestResults$p.value < 0.001, "p < .001", ifelse(ttestResults$p.value < 0.01, "p < .01", ifelse(ttestResults$p.value < 0.05, "p < .05", paste("p = ", round(ttestResults$p.value, 2))))))
          }
          else{
            text <- paste0("A T-Test did not show significant differences in ", nameMeasure, " between ", SummaryData$condition1, " condition (Mean = ", round(SummaryData$mean1, 2), ", SD = ", round(SummaryData$sd1, 2), ")" , " and ", SummaryData$condition2, " condition ", "(Mean = ", round(SummaryData$mean2, 2), ", SD = ", round(SummaryData$sd2, 2) ,"), ", "Z = ", round(qnorm(ttestResults$p.value/2), 2), ", ", ifelse(ttestResults$p.value < 0.001, "p < .001", ifelse(ttestResults$p.value < 0.01, "p < .01", ifelse(ttestResults$p.value < 0.05, "p < .05", paste("p = ", round(ttestResults$p.value, 2))))))
          }
          
        }
    }
    
    
    }
  
  if("Condition" %in% colnames(audioData) & "Dimension" %in% colnames(audioData) & includeDimensions){
    if(min(normalityData$pValue)>=0.05){
      res.aov1 <- aov(as.formula(paste(measure, "~", "Condition", "*", "Dimension")), data = audioData)
      res.aov2 <- summary(res.aov1)
      text <- paste0(toupper(substr(nameMeasure, 1, 1)), substr(nameMeasure, 2, nchar(nameMeasure)), " measure was subjected to a two-way analysis of variance having ",
                     length(unique(audioData[,"Condition"])), " condition levels (", toString(unique(audioData[,"Condition"])), ") and ", length(unique(audioData[,"Dimension"])),
                     " dimension levels (", toString(unique(audioData[,"Dimension"])),"). ")
      
      if(all(res.aov2[[1]]$`Pr(>F)`[-length(res.aov2[[1]]$`Pr(>F)`)] < 0.05)){
        text <- paste0(text, " All effects were statistically significant at the 0.05 significance level.\n")
      }
      
      if(all(res.aov2[[1]]$`Pr(>F)`[-length(res.aov2[[1]]$`Pr(>F)`)] > 0.05)){
        text <- paste0(text, " No significant statistically significant effects were found at the 0.05 significance level.\n")
      }
      
      
      
      if(any(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-2)] < 0.05, na.rm = TRUE)){
        for (i in 1:(length(which(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-2)] < 0.05)))) {
          position <- which(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-2)] < 0.05)[i]
          text <- paste0(text, "There was a significant main effect for ", trimws(rownames(res.aov2[[1]])[position]), ", F(", res.aov2[[1]]$Df[position],
                         ", ", res.aov2[[1]]["Residuals",]$Df, ") = ", round(res.aov2[[1]]$`F value`[position], 2), ", ", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.001, "p < .001", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.01, "p < .01", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.05, "p < .05", paste("p = ", round(res.aov2[[1]]$`Pr(>F)`[position], 2))))))
          
          if(res.aov2[[1]]$`Pr(>F)`[length(res.aov2[[1]]$`Pr(>F)`)-1] > 0.05){
            if(length(unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])) > 2){
              text <- paste0(text, ". ")
              
              tukeyData <- TukeyHSD(aov(as.formula(paste0(measure, "~", trimws(rownames(res.aov2[[1]])[position]))), data = audioData))
              tukeyData <- as.data.frame(tukeyData[[trimws(rownames(res.aov2[[1]])[position])]])
              tukeyData$group1 <- stringr::str_split(rownames(tukeyData), "-", simplify = T)[,1]
              tukeyData$group2 <- stringr::str_split(rownames(tukeyData), "-", simplify = T)[,2]
              rownames(tukeyData) <- stringr::str_replace(rownames(tukeyData), "-", " and ")
              
              if(any(tukeyData$`p adj` < 0.05)){
                for (j in 1:nrow(tukeyData)) {
                  tukeyData$mean1[j] <- mean(audioData[audioData[,trimws(rownames(res.aov2[[1]])[position])] == tukeyData$group1[j], measure], na.rm = TRUE)
                  tukeyData$mean2[j] <- mean(audioData[audioData[,trimws(rownames(res.aov2[[1]])[position])] == tukeyData$group2[j], measure], na.rm = TRUE)
                  tukeyData$comparison[j] <- ifelse(tukeyData$mean1[j] > tukeyData$mean2[j], "greater", ifelse(tukeyData$mean1[j] == tukeyData$mean2[j], "equal", "smaller"))
                  tukeyData$sd1[j] <- sd(audioData[audioData[,trimws(rownames(res.aov2[[1]])[position])] == tukeyData$group1[j], measure], na.rm = TRUE)
                  tukeyData$sd2[j] <- sd(audioData[audioData[,trimws(rownames(res.aov2[[1]])[position])] == tukeyData$group2[j], measure], na.rm = TRUE)
                }
                
                
                text <- paste0(text, " Post hoc comparisons using the Tukey HSD Test indicated that ")
                for (j in 1:nrow(tukeyData[tukeyData$`p adj` < 0.05,])) {
                  if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1 & j < nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
                    text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[j], " ", trimws(rownames(res.aov2[[1]])[position]),  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[j], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j], 2))))), ")", " than in the ", tukeyData$group2[j], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[j] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[j], 2), ")", ", ")
                  }
                  else if(nrow(tukeyData[tukeyData$`p adj` < 0.05,]) > 1  & j == nrow(tukeyData[tukeyData$`p adj` < 0.05,]) - 1){
                    text <- paste0(text," ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[j], " ", trimws(rownames(res.aov2[[1]])[position]),  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[j], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j], 2))))), ")", " than in the ", tukeyData$group2[j], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[j] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[j], 2), ")", " and ")
                  }
                  else{
                    text <- paste0(text, " ", nameMeasure, " of the audios in the ", tukeyData[tukeyData$`p adj` < 0.05,]$group1[j], " ", trimws(rownames(res.aov2[[1]])[position]),  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean1[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd1[j], 2), ")", " were significantly ", tukeyData[tukeyData$`p adj` < 0.05,]$comparison[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$`p adj`[j], 2))))), ")", " than in the ", tukeyData$group2[j], " condition ", tukeyData[tukeyData$`p adj` < 0.05,]$Comparison[j] ,  " (M = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$mean2[j], 2), ", SD = ", round(tukeyData[tukeyData$`p adj` < 0.05,]$sd2[j], 2), ")", ".")
                  }
                  
                }
              }
              if(any(tukeyData$`p adj` > 0.05)){
                text <- paste0(text, " However, no significant differences were found between ")
                for (j in 1:nrow(tukeyData[tukeyData$`p adj` > 0.05,])) {
                  if(nrow(tukeyData[tukeyData$`p adj` > 0.05,]) > 1 & j < nrow(tukeyData[tukeyData$`p adj` > 0.05,]) - 1){
                    text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j], 2))))), ")" ,", ")
                  }
                  else if(nrow(tukeyData[tukeyData$`p adj` > 0.05,]) > 1  & j == nrow(tukeyData[tukeyData$`p adj` > 0.05,]) - 1){
                    text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j], 2))))), ") " , " and ")
                  }
                  else{
                    text <- paste0(text, rownames(tukeyData[tukeyData$`p adj` > 0.05,])[j], " (Holm-Bonferroni adjusted ", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.001, "p < .001", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.01, "p < .01", ifelse(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j] < 0.05, "p < .05", paste("p = ", round(tukeyData[tukeyData$`p adj` > 0.05,]$`p adj`[j], 2))))), ")" , " conditions.")
                  }
                }
                
                
              }
              
            }
            else if(length(unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])) == 2){
              comparisonTable <- data.frame(Name1 = unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[1],
                                            Mean1 = round(mean(audioData[audioData[,trimws(rownames(res.aov2[[1]])[i])] ==
                                                                           unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[1], measure], na.rm = TRUE), 2),
                                            SD1 = round(sd(audioData[audioData[,trimws(rownames(res.aov2[[1]])[i])] ==
                                                                       unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[1], measure], na.rm = TRUE), 2),
                                            Name2 = unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[2],
                                            Mean2 = round(mean(audioData[audioData[,trimws(rownames(res.aov2[[1]])[i])] ==
                                                                           unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[2], measure], na.rm = TRUE), 2),
                                            SD2 = round(sd(audioData[audioData[,trimws(rownames(res.aov2[[1]])[i])] ==
                                                                       unique(audioData[,trimws(rownames(res.aov2[[1]])[i])])[2], measure], na.rm = TRUE), 2))
              comparisonTable$relationship <- ifelse(comparisonTable$Mean1 > comparisonTable$Mean2, "greater", "smaller")
              text <- paste0(text, ", such that the average ", nameMeasure, " was significantly ", comparisonTable$relationship, " for ", comparisonTable$Name1, " (M = ",
                             comparisonTable$Mean1, ", SD = ", comparisonTable$SD1, ") than for ", comparisonTable$Name2, " (M = ",
                             comparisonTable$Mean2, ", SD = ", comparisonTable$SD2, ").")
            }
          }
          else{
            text <- paste0(text, ". ")
          }
          
          
        }
      }
      
      if(any(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-1)] > 0.05, na.rm = TRUE)) {
        for (i in 1:(length(which(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-1)] > 0.05)))) {
          position <- which(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-1)] > 0.05)[i]
          if(any(res.aov2[[1]]$`Pr(>F)`[1:(length(res.aov2[[1]]$`Pr(>F)`)-1)] < 0.05, na.rm = TRUE) & i == 1){
            text <- paste0(text, " However,")
            if(position == (length(res.aov2[[1]]$`Pr(>F)`)-1)){
              text <- paste0(text, " the interaction effect")
            }
            else{
              text <- paste0(text, " the main effect of ", trimws(rownames(res.aov2[[1]])[i]))
            }
          }
          else{
            if(position == (length(res.aov2[[1]]$`Pr(>F)`)-1)){
              text <- paste0(text, " The interaction effect")
            }
            else{
              text <- paste0(text, " The main effect of ", trimws(rownames(res.aov2[[1]])[i]))
            }
          }
          
          text <- paste0(text, " was non-significant, F(", res.aov2[[1]]$Df[i],
                         ", ", res.aov2[[1]]["Residuals",]$Df, ") = ", round(res.aov2[[1]]$`F value`[i], 2), ", ", ifelse(res.aov2[[1]]$`Pr(>F)`[i] < 0.001, "p < .001", ifelse(res.aov2[[1]]$`Pr(>F)`[i] < 0.01, "p < .01", ifelse(res.aov2[[1]]$`Pr(>F)`[i] < 0.05, "p < .05", paste("p = ", round(res.aov2[[1]]$`Pr(>F)`[i], 2))))), ". ")
        }
        
      }
      
      if(res.aov2[[1]]$`Pr(>F)`[(length(res.aov2[[1]]$`Pr(>F)`)-1)] < 0.05){
        position <- length(res.aov2[[1]]$`Pr(>F)`)-1
        text <- paste0(text, " The interaction effect was significant", ", F(", res.aov2[[1]]$Df[position],
                       ", ", res.aov2[[1]]["Residuals",]$Df, ") = ", round(res.aov2[[1]]$`F value`[position], 2), ", ", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.001, "p < .001", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.01, "p < .01", ifelse(res.aov2[[1]]$`Pr(>F)`[position] < 0.05, "p < .05", paste("p = ", round(res.aov2[[1]]$`Pr(>F)`[position], 2))))), ".")
        
        MeanData <- do.call(data.frame,aggregate(as.formula(paste(measure, "~", "Condition", "*", "Dimension")), data = audioData, FUN = function(x) c(mean = mean(x, na.rm = TRUE), n = round(length(x),0), sd = sd(x, na.rm = TRUE))))
        colnames(MeanData) <- c("Condition", "Dimension", "Mean", "N", "SD")
        
        
        SimpleMainEffectsTable <- phia::testInteractions(res.aov2, fixed = "Condition", across = "Dimension")
        
        
        
        if(any(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] < 0.05, na.rm = TRUE)){
          text <- paste0(text, " Simple main effects analysis showed that ", measure, " was ")
          for(i in 1:(length(which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] < 0.05)))){
            position <- which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] < 0.05)[i]
            
            for(j in 1:(length(unique(audioData$Dimension))-1)){
              text <- paste0(text, "significantly ", ifelse(sign(SimpleMainEffectsTable[position, j]) == "-", "smaller", "greater"), " for the ", unique(audioData$Dimension)[1],
                             " dimension than for the ", unique(audioData$Dimension)[j+1], " dimension in the ", trimws(rownames(SimpleMainEffectsTable)[position]), " condition (p = ",
                             round(SimpleMainEffectsTable$`Pr(>F)`[position], 2), ")")
              if((length(unique(audioData$Dimension))-1) > 1 & j != (length(unique(audioData$Dimension))-1)){
                text <- paste0(text, "; ")
              }
              
            }
            
            if(i == (length(which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] < 0.05)))){
              text <- paste0(text, ". ")
            }
            else{
              text <- paste0(text, "; ")
            }
            
            
          }
        }
        
        if(any(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] > 0.05, na.rm = TRUE)){
          if(any(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] < 0.05, na.rm = TRUE)){
            text <- paste0(text, " However, there were no significant differences")
          }
          else{
            text <- paste0(text, " Simple main effects analysis showed that there were no significant differences for ", measure)
          }
          
          for(i in 1:(length(which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] > 0.05)))){
            position <- which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] > 0.05)[i]
            
            for(j in 1:(length(unique(audioData$Dimension))-1)){
              text <- paste0(text,  " between ", unique(audioData$Dimension)[1],
                             " dimension and ", unique(audioData$Dimension)[j+1], " dimension in the ", trimws(rownames(SimpleMainEffectsTable)[position]), " condition (p = ",
                             round(SimpleMainEffectsTable$`Pr(>F)`[position], 2), ")")
              if((length(unique(audioData$Dimension))-1) > 1 & j != (length(unique(audioData$Dimension))-1)){
                text <- paste0(text, "; ")
              }
              
            }
            
            if(i == (length(which(SimpleMainEffectsTable$`Pr(>F)`[1:(length(SimpleMainEffectsTable$`Pr(>F)`)-1)] > 0.05)))){
              text <- paste0(text, ". ")
            }
            else{
              text <- paste0(text, "; ")
            }
            
          }
          
        }
        
        
      }
    
    
    
    }
    else{
      res.schreirer <- rcompanion::scheirerRayHare(as.formula(paste(measure, "~", "Condition", "*", "Dimension")), audioData, verbose = FALSE)
      text <- paste0(toupper(substr(nameMeasure, 1, 1)), substr(nameMeasure, 2, nchar(nameMeasure)), " measure was subjected to a Scheirer-Ray-Hare test having ",
                     length(unique(audioData[,"Condition"])), " condition levels (", toString(unique(audioData[,"Condition"])), ") and ", length(unique(audioData[,"Dimension"])),
                     " dimension levels (", toString(unique(audioData[,"Dimension"])),"). ")
      
      if(all(res.schreirer$p.value[-length(res.schreirer$p.value)] < 0.05)){
        text <- paste0(text, " All effects were statistically significant at the 0.05 significance level.\n")
      }
      
      if(all(res.schreirer$p.value[-length(res.schreirer$p.value)] > 0.05)){
        text <- paste0(text, " No statistically significant effects were found at the 0.05 significance level.\n")
      }
        
        
        if(any(res.schreirer$p.value[1:(length(res.schreirer$p.value)-2)] < 0.05, na.rm = TRUE)){
          for (i in 1:(length(which(res.schreirer$p.value[1:(length(res.schreirer$p.value)-2)] < 0.05)))) {
            position <- which(res.schreirer$p.value[1:(length(res.schreirer$p.value)-2)] < 0.05)[i]
            text <- paste0(text, "There was a significant main effect for ", trimws(rownames(res.schreirer)[position]), ", H(", res.schreirer$Df[position],
                            ") = ", round(res.schreirer$H[position], 2), ", ", ifelse(res.schreirer$p.value[position] < 0.001, "p < .001", ifelse(res.schreirer$p.value[position] < 0.01, "p < .01", ifelse(res.schreirer$p.value[position] < 0.05, "p < .05", paste("p = ", round(res.schreirer$p.value[position], 2))))))
            
            if(res.schreirer$p.value[length(res.schreirer$p.value)-1] > 0.05 & length(unique(audioData[,trimws(rownames(res.schreirer)[position])])) > 2){
              
                text <- paste0(text, ". ")
                
                audioData$VarRank <- rank(audioData[,measure], ties.method = "average")
                dunnData <- FSA::dunnTest(as.formula(paste0(measure, "~", trimws(rownames(res.schreirer)[position]))), data = audioData)
                dunnData$res$Comparison <- stringr::str_replace(dunnData$res$Comparison, "-", "and")
                
                if(any(dunnData$res$P.adj < 0.05)){
                  text <- paste0(text, " Post hoc comparisons using the Dunn's Test showed significant differences in ", nameMeasure, "'s mean rank between ")
                  
                  for (j in 1:nrow(dunnData$res[dunnData$res$P.adj < 0.05,])) {
                    if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1 & j < nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                      text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j], 2))))), ")" ,", ")
                    }
                    else if(nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) > 1  & j == nrow(dunnData$res[dunnData$res$P.adj < 0.05,]) - 1){
                      text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j], 2))))), ") " , " and ")
                    }
                    else{
                      text <- paste0(text, dunnData$res[dunnData$res$P.adj < 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj < 0.05,]$P.adj[j], 2))))), ")" , ".")
                    }
                    
                  }
                  if(any(dunnData$res$P.adj > 0.05)){
                    text <- paste0(text, " However, no significant differences were found between ")
                    for (j in 1:nrow(dunnData$res[dunnData$res$P.adj > 0.05,])) {
                      if(nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) > 1 & j < nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) - 1){
                        text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj > 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj > 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj > 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj > 0.05,]$P.adj[j], 2))))), ")" ,", ")
                      }
                      else if(nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) > 1  & j == nrow(dunnData$res[dunnData$res$P.adj > 0.05,]) - 1){
                        text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j], 2))))), ") " , "and ")
                      }
                      else{
                        text <- paste0(text, dunnData$res[dunnData$res$P.adj > 0.05,]$Comparison[j], " (Holm-Bonferroni adjusted ", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.001, "p < .001", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.01, "p < .01", ifelse(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j] < 0.05, "p < .05", paste("p = ", round(dunnData$res[dunnData$res$P.adj > 0.05,]$P.adj[j], 2))))), ")" , trimws(rownames(res.schreirer)[position]), ". ")
                      }
                    }
                  }
                }
                if(all(dunnData$res$P.adj > 0.05)){
                  text <- paste0(text, " Although, post hoc comparisons using the Dunn's Test did not show any significant differences in ", nameMeasure, "'s mean rank. ")
                  
                }
                
                
              
            }
            
          }
        }
        
        
      
      
    
    }
  }
  
  return(text)
}
```



This is an automatically generated report by VoiceR.

# Statistics Table

```{r Statistics Table, echo=FALSE, message=FALSE, warning=FALSE}
DT::datatable(params$audioData, options = list(pageLength = 10, scrollX = TRUE))
```


# Normality Plots

```{r include=FALSE}
audioData <- params$audioData
text <- createNormalityText(audioData, "duration", "duration", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[1], BoxCoxConstant = params$avoidNormalCheck[9])
```




**Duration**

`r text`


```{r include=FALSE}

text <- createNormalityText(audioData, "voice_breaks_percent", "voice breaks percentage", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[2], BoxCoxConstant = params$avoidNormalCheck[10])
```


**Voice Breaks Percentage**

`r text`

```{r include=FALSE}
normalPlots <- params$normalPlots
for (j in 1:length(params$normalPlots)) {
  normalPlots[[j]]$layers[[2]] <- NULL
  normalPlots[[j]]$layer[[2]] <- NULL
}

```



```{r Normal Plot 1 and 2, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(normalPlots[[1]]))
normalPlots[[1]] + ggplot2::labs(title="Density Plot of Audio Duration \n by Condition") + ggthemes::theme_fivethirtyeight()

if(!is.null(normalPlots[[2]]))
normalPlots[[2]] + ggplot2::labs(title="Density Plot of Voice Breaks Percentage \n by Condition") + ggthemes::theme_fivethirtyeight()

```


```{r include=FALSE}
text <- createNormalityText(audioData, "RMS_env", "RMS of Amplitude envelope", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[3], BoxCoxConstant = params$avoidNormalCheck[11])
```


**Root Mean Square (RMS) of Amplitude envelope**

`r text`

```{r include=FALSE}
text <- createNormalityText(audioData, "mean_loudness", "loudness", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[4], BoxCoxConstant = params$avoidNormalCheck[12])
```

**Loudness**

`r text`



```{r Normal Plot 3 and 4, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(normalPlots[[3]]))
normalPlots[[3]] + ggplot2::labs(title="Density Plot of RMS of the amplitude envelope \n by Condition") + ggthemes::theme_fivethirtyeight()

if(!is.null(normalPlots[[4]]))
normalPlots[[4]] + ggplot2::labs(title="Density Plot of Loudness \n by Condition") + ggthemes::theme_fivethirtyeight()

```


```{r include=FALSE}
text <- createNormalityText(audioData, "mean_F0", "average pitch", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[5], BoxCoxConstant = params$avoidNormalCheck[13])
```


**Mean Fundamental Frequency (F0)**

`r text`

```{r include=FALSE}
text <- createNormalityText(audioData, "sd_F0", "pitch's standard deviation", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[6], BoxCoxConstant = params$avoidNormalCheck[14])
```

**Standard Deviation (sd) of F0**

`r text`


```{r Normal Plot 5 and 6, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(normalPlots[[5]]))
normalPlots[[5]] + ggplot2::labs(title="Density Plot of Average Pitch \n by Condition") + ggthemes::theme_fivethirtyeight()

if(!is.null(normalPlots[[6]]))
normalPlots[[6]] + ggplot2::labs(title="Density Plot of Pitch's Standard Deviation \n by Condition") + ggthemes::theme_fivethirtyeight()

```


```{r include=FALSE}
text <- createNormalityText(audioData, "mean_entropy", "average Wiener entropy", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[7], BoxCoxConstant = params$avoidNormalCheck[15])
```



**Average Wiener Entropy**

`r text`

```{r include=FALSE}
text <- createNormalityText(audioData, "mean_HNR", "average Harmonics-to-Noise Ratio", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[8], BoxCoxConstant = params$avoidNormalCheck[16])
```

**Average Harmonics-to-Noise Ratio**

`r text`



```{r Normal Plot 7 and 8, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
normalPlots[[7]] + ggplot2::labs(title="Density Plot of Average Entropy \n by Condition") + ggthemes::theme_fivethirtyeight()

normalPlots[[8]] + ggplot2::labs(title="Density Plot of Average Harmonics-to-Noise Ratio \n by Condition") + ggthemes::theme_fivethirtyeight()
```

# Comparison Plots

```{r include=FALSE}

text  <- createComparisonText(audioData, "duration", "duration", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[1])

```

**Duration**

`r text`

```{r include=FALSE}

text  <- createComparisonText(audioData, "voice_breaks_percent", "voice breaks percentage", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[2])

```

**Voice Breaks Percentage**

`r text`


```{r Plot 1 and 2, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
comparisons <- params$comparisons
if(params$includeDimensions){
  if(!is.null(comparisons[[1]]))
  comparisons[[1]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[2]]))
  comparisons[[2]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[3]]))
  comparisons[[3]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[4]]))
  comparisons[[4]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[5]]))
  comparisons[[5]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[6]]))
  comparisons[[6]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[7]]))
  comparisons[[7]]$layers[[2]] <- NULL
  
  if(!is.null(comparisons[[8]]))
  comparisons[[8]]$layers[[2]] <- NULL
}

if(!is.null(comparisons[[1]]))
comparisons[[1]] + ggplot2::labs(title="Plot of Audio Duration \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())

if(!is.null(comparisons[[2]]))
comparisons[[2]] + ggplot2::labs(title="Plot of Voice Breaks Percentage \n by Condition") + ggthemes::theme_fivethirtyeight()  + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())

```

```{r include=FALSE}

text  <- createComparisonText(audioData, "RMS_env", "RMS of the amplitude envelope", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[3])

```

**RMS of the amplitude envelope**

`r text`

```{r include=FALSE}

text  <- createComparisonText(audioData, "mean_loudness", "loudness", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[4])

```

**Loudness**

`r text`

```{r Plot 3 and 4, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(comparisons[[3]]))
comparisons[[3]] + ggplot2::labs(title="Plot of RMS of the amplitude envelope \n by Condition") + ggthemes::theme_fivethirtyeight()  + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())

if(!is.null(comparisons[[4]]))
comparisons[[4]] + ggplot2::labs(title="Plot of Loudness \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())
```

```{r include=FALSE}

text  <- createComparisonText(audioData, "mean_F0", "average Pitch", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[5])

```

**Average Pitch**

`r text`

```{r include=FALSE}

text  <- createComparisonText(audioData, "sd_F0", "pitch's Standard Deviation", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[6])

```

**SD Pitch**

`r text`

```{r Plot 5 and 6, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(comparisons[[5]]))
comparisons[[5]] + ggplot2::labs(title="Plot of Average F0 \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())

if(!is.null(comparisons[[6]]))
comparisons[[6]] + ggplot2::labs(title="Plot of F0 Standard Deviation \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())
```

```{r include=FALSE}

text  <- createComparisonText(audioData, "mean_entropy", "average Entropy", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[7])

```

**Average Entropy**

`r text`

```{r include=FALSE}

text  <- createComparisonText(audioData, "mean_HNR", "average Harmonics-to-Noise Ratio", includeDimensions = params$includeDimensions, avoidNormalCheck = params$avoidNormalCheck[8])

```

**Average Harmonics-to-Noise Ratio**

`r text`

```{r Plot 7 and 8, echo=FALSE, message=FALSE, warning=FALSE, out.width="50%"}
if(!is.null(comparisons[[7]]))
comparisons[[7]] + ggplot2::labs(title="Plot of Average Entropy \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())

if(!is.null(comparisons[[8]]))
comparisons[[8]] + ggplot2::labs(title="Plot of Average Harmonics-To-Noise Ratio \n by Condition") + ggthemes::theme_fivethirtyeight() + ggplot2::theme(panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), axis.line.x = ggplot2::element_line(), axis.line.y = ggplot2::element_line())
```

# Appendices {.tabset}

## Appendix A: General Data Information

```{r echo=FALSE, warning=FALSE}
nameMeasures = c("Duration", "Voice Breaks Percentage", "RMS of the amplitude envelope", "Loudness", "Avg. Pitch", "Pitch SD", "Avg Entropy", "Avg HNR")
figureNumber = 1
tableSummary(audioData, by = c(), figureNumber = paste0("A", figureNumber), nameMeasures = nameMeasures)
```

```{r echo=FALSE, warning=FALSE}

if("Condition" %in% colnames(audioData)){
  figureNumber <- figureNumber + 1
  tableSummary(audioData, by = c("Condition"), figureNumber = paste0("A", figureNumber), nameMeasures = nameMeasures)
}

```

```{r echo=FALSE, warning=FALSE}
if("Dimension" %in% colnames(audioData) & params$includeDimensions){
  figureNumber <- figureNumber + 1
  tableSummary(audioData, by = c("Dimension"), figureNumber = paste0("A", figureNumber), nameMeasures = nameMeasures)
}

```

```{r echo=FALSE, warning=FALSE}
if("Dimension" %in% colnames(audioData) & params$includeDimensions){
  figureNumber <- figureNumber + 1
  tableSummary(audioData, by = c("Condition", "Dimension"), figureNumber = paste0("A", figureNumber), nameMeasures = nameMeasures)
}

```

## Appendix B: Normality Tables {.tabset .tabset-pills}

### Duration

```{r echo=FALSE, message=FALSE, warning=FALSE}
#Duration Normality
durationNormalityTable <- tableNormality(audioData, "duration", includeDimensions = params$includeDimensions)

figureNumber <- 1
tableNormality(audioData, "duration", nameMeasure = "Duration", includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### Voice Breaks Percentage

```{r echo=FALSE, message=FALSE, warning=FALSE}
#voice_breaks_percent Normality
voicedPercentNormalityTable <- tableNormality(audioData, "voice_breaks_percent", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "voice_breaks_percent", nameMeasure = "Voice Breaks Percentage",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### RMS of the amplitude envelope

```{r echo=FALSE, message=FALSE, warning=FALSE}
#RMS amplitude Normality
RMSamplitudeNormalityTable <- tableNormality(audioData, "RMS_env", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "RMS_env", nameMeasure = "RMS of the amplitude envelope",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### Loudness

```{r echo=FALSE, message=FALSE, warning=FALSE}
#Loudness amplitude Normality
loudnessNormalityTable <- tableNormality(audioData, "mean_loudness", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "mean_loudness", nameMeasure = "Loudness",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### Mean Pitch

```{r echo=FALSE, message=FALSE, warning=FALSE}
#Pitch
pitchNormalityTable <- tableNormality(audioData, "mean_F0", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "mean_F0", nameMeasure = "Average F0",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### SD Pitch

```{r echo=FALSE, message=FALSE, warning=FALSE}
#SD Pitch
sdPitchNormalityTable <- tableNormality(audioData, "sd_F0", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "sd_F0", nameMeasure = "F0 Standard Deviation",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### Entropy

```{r echo=FALSE, message=FALSE, warning=FALSE}
#Entropy
entropyNormalityTable <- tableNormality(audioData, "mean_entropy", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "mean_entropy", nameMeasure = "Average Entropy",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

### HNR

```{r echo=FALSE, message=FALSE, warning=FALSE}
#HNR
hnrNormalityTable <- tableNormality(audioData, "mean_HNR", includeDimensions = params$includeDimensions)

figureNumber <- figureNumber + 1
tableNormality(audioData, "mean_HNR", nameMeasure = "Average Harmonics-to-Noise Ratio",includeDimensions = params$includeDimensions, HTMLTable = TRUE, figureNumber = paste0("B", figureNumber))

```

## Appendix C: Comparison Tests {.tabset .tabset-pills}

```{r include=FALSE}
TablesToGenerate <- function(audioData, measure, nameMeasure, includeDimensions, isNormal){
  TablesToReport <- vector(mode = "numeric", length = 13)
  figureNumber <- 0
  if(as.logical(includeDimensions)){
    if(isNormal){
      figureNumber <- figureNumber + 1
      TablesToReport[figureNumber] <- 1
      formula = as.formula(paste(measure, "~ Condition * Dimension"))
      AnovaTestData <- summary(aov(formula, audioData))[[1]]
      if(AnovaTestData$`Pr(>F)`[3] < 0.05){
        figureNumber <- figureNumber + 1
       TablesToReport[figureNumber] <- 2
      }
      else{
        if(AnovaTestData$`Pr(>F)`[1] < 0.05){
          if(length(unique(audioData$Condition)) > 2){
            figureNumber <- figureNumber + 1
            TablesToReport[figureNumber] <- 3
          }
        }
        if(AnovaTestData$`Pr(>F)`[2] < 0.05){
          if(length(unique(audioData$Dimension)) > 2){
            figureNumber <- figureNumber + 1
            TablesToReport[figureNumber] <- 4
          }
        }
      }
    }
    else{
      figureNumber <- figureNumber + 1
      TablesToReport[figureNumber] <- 5
      formula = as.formula(paste(measure, "~ Condition * Dimension"))
      res.schreirer <- rcompanion::scheirerRayHare(as.formula(paste(measure, "~ Condition * Dimension")), audioData, verbose = FALSE)
      if(res.schreirer$p.value[3] < 0.05){
        
      }
      else{
        if(res.schreirer$p.value[1] < 0.05){
          if(length(unique(audioData$Condition)) > 2){
              figureNumber <- figureNumber + 1
              TablesToReport[figureNumber] <- 6
            }
        }
        if(res.schreirer$p.value[2] < 0.05){
          if(length(unique(audioData$Dimension)) > 2){
              figureNumber <- figureNumber + 1
              TablesToReport[figureNumber] <- 7
            }
        }
      }
  
    }
  }else{
    if(isNormal){
      if(length(unique(audioData$Condition)) > 2){
        figureNumber <- figureNumber + 1
        TablesToReport[figureNumber] <- 8
        formula = as.formula(paste(measure, "~ Condition"))
        AnovaTestData <- summary(aov(formula, audioData))[[1]]
        if(AnovaTestData$`Pr(>F)`[1] < 0.05){
          if(length(unique(audioData$Condition)) > 2){
            figureNumber <- figureNumber + 1
            TablesToReport[figureNumber] <- 9
          }
        }
  
      }
      else{
        figureNumber <- figureNumber + 1
        TablesToReport[figureNumber] <- 13
      }
    }
    else{
      if(length(unique(audioData$Condition)) > 2){
        figureNumber <- figureNumber + 1
        TablesToReport[figureNumber] <- 10
        
        figureNumber <- figureNumber + 1
        TablesToReport[figureNumber] <- 11
        formula = as.formula(paste(measure, "~ Condition"))
        kruskalTestData <- kruskal.test(formula, audioData)
        
        if(kruskalTestData$p.value < 0.05){
          if(length(unique(audioData$Condition)) > 2){
            figureNumber <- figureNumber + 1
            TablesToReport[figureNumber] <- 12
          }
        }
  
      }
      else{
        figureNumber <- figureNumber + 1
        TablesToReport[figureNumber] <- 13
      }
    }
  }
  return(TablesToReport)
}
```



### Duration

```{r echo=FALSE, warning=FALSE}
measure <- "duration"
nameMeasure <- "Duration"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(durationNormalityTable$pValue) >= 0.05 | as.logical(params$avoidNormalCheck[1]))
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}




```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  cat("No tables generated for t-test")
}
        
```


### Voice Breaks Percentage

```{r echo=FALSE, warning=FALSE}
measure <- "voice_breaks_percent"
nameMeasure <- "Voice Breaks Percentage"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(voicedPercentNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[2])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}



```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### RMS of the amplitude envelope

```{r echo=FALSE, warning=FALSE}
measure <- "RMS_env"
nameMeasure <- "RMS of the amplitude envelope"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(RMSamplitudeNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[3])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}



```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### Loudness

```{r echo=FALSE, warning=FALSE}
measure <- "mean_loudness"
nameMeasure <- "Loudness"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(loudnessNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[4])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}


```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### Mean F0

```{r echo=FALSE, warning=FALSE}
measure <- "mean_F0"
nameMeasure <- "Avg. Fundamental Frequency"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(pitchNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[5])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}



```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### SD F0

```{r echo=FALSE, warning=FALSE}
measure <- "sd_F0"
nameMeasure <- "F0 Standard Deviation"

if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(sdPitchNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[6])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}


```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### Mean Entropy

```{r echo=FALSE, warning=FALSE}
measure <- "mean_entropy"
nameMeasure <- "Average Entropy"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(entropyNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[7])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}


```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}
        
```

### Mean HNR

```{r echo=FALSE, warning=FALSE}
measure <- "mean_HNR"
nameMeasure <- "Average Harmonics-to-Noise Ratio"
if(sum(!is.na(audioData[,measure])) >= 3){
  isNormal <- (min(hnrNormalityTable$pValue) >= 0.05 | params$avoidNormalCheck[8])
  TablesToReport <- TablesToGenerate(audioData, measure, nameMeasure, params$includeDimensions, isNormal)
}else{
  TablesToReport <- c()
}


```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(1 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 1)
  tableANOVA(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(2 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 2)
  tableSimpleMainEffects(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(3 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 3)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(4 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 4)
  tableTukey(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(5 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 5)
  tableSchreirer(audioData, by = c("Condition", "Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(6 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 6)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(7 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 7)
  tableDunn(audioData, by = c("Dimension"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(8 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 8)
  tableANOVA(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))

}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(9 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 9)
  tableTukey(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(10 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 10)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = TRUE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(11 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 11)
  tableKruskal(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber), InfoTable = FALSE)
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(12 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  figureNumber <- which(TablesToReport == 12)
  tableDunn(audioData, by = c("Condition"), measure = measure, nameMeasure = nameMeasure, figureNumber = paste0("C", figureNumber))
}
        
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
if(13 %in% TablesToReport && sum(!is.na(audioData[,measure])) >= 3){
  print("No tables generated for t-test")
}


        
```

