ggtitle("Probability Gun was used in the Crime") +
scale_fill_manual(values = c("orange", "purple"))+
theme_bw()+
theme(axis.title.x = element_blank())+
scale_x_discrete(labels=c('1\nNot\nat all\nstrong', '2', '3', '4', '5\nModerately\nstrong', '6', '7', '8', '9\nExtremely\nstrong'))
#| label: fig-mistakes
#| fig-cap: Histogram of perceived frequency of mistakes made by firearms examiners
#| fig-width: 7
#| fig-height: 3
#|
#| fig-align: center
#| echo: false
#| warning: false
merged_results$mistakes=factor(merged_results$mistakes, levels =c("Never","Rarely", "Occasionally",
"Sometimes", "Frequently", "Usually", "Always"))
ggplot(subset(merged_results, !is.na(mistakes)), aes(x=mistakes, fill = conclusion))+
geom_bar(mapping = aes(y = ..prop.., group = conclusion), position=position_dodge(preserve = "single"), color="black") +
#  geom_histogram(stat="count", position="dodge")+
facet_grid(picture~., labeller = label_both) +
ggtitle(
"How often do firearms examiners make mistakes when determining whether \n bullets were fired through the same gun?"
) +
scale_fill_manual(values = c("orange", "grey40", "darkslategray4")) +
theme_bw()+
theme(axis.title.x = element_blank())
#| label: fig-hist_cred
#| fig-cap: Histogram of perceived credibility of experts
#| fig-width: 7
#| fig-height: 3
#|
#| fig-align: center
#| echo: false
#| warning: false
algtest_table<-table(merged_results$algtestcred)
alg_df<-data.frame(algtest_table, question="algorithm")
firetest_table<-table(merged_results[merged_results$algorithm=="Yes",]$firetestcred)
fire_df<- data.frame(firetest_table, question="firearm")
test_df<-rbind(alg_df, fire_df)
levels(test_df$Var1) <- gsub(" ", "\n", levels(test_df$Var1))
test_df$Var1=factor(test_df$Var1, levels = c("Extremely\nnoncredible","Moderately\nnoncredible","Weakly\nnoncredible",
"Neither\ncredible\nnor\nnoncredible", "Weakly\ncredible", "Moderately\ncredible",
"Extremely\ncredible"))
ggplot(test_df, aes(Var1, Freq, fill=question))+
geom_bar(stat="identity", position=position_dodge(preserve = "single"), color="black")+
ggtitle("How credible did you find the testimony of the ___ expert?")+
scale_fill_manual(values = c("gray", "black")) +
theme_bw()+
theme(axis.title.x = element_blank())
#| label: fig-hist_rel
#| fig-cap: Histogram of perceived reliability of evidence
#| fig-width: 7
#| fig-height: 3
#|
#| fig-align: center
#| echo: false
#| warning: false
algrel_table<-table(merged_results$algrel)
algrel_df<-data.frame(algrel_table, question="algorithm")
examrel_table<-table(merged_results[merged_results$algorithm=="Yes",]$examrel)
examrel_df<- data.frame(examrel_table, question="examiner")
rel_df<-rbind(algrel_df, examrel_df)
levels(rel_df$Var1) <- gsub(" ", "\n", levels(rel_df$Var1))
rel_df$Var1=factor(rel_df$Var1, levels = c("Extremely\nunreliable","Moderately\nunreliable","Weakly\nunreliable",
"Neither\nreliable\nnor\nunreliable", "Weakly\nreliable", "Moderately\nreliable",
"Extremely\nreliable"))
ggplot(rel_df, aes(Var1, Freq, fill=question))+
geom_bar(stat="identity", position=position_dodge(preserve = "single"), color="black")+
ggtitle("How reliable do you think the ____ evidence is, in this case?")+
scale_fill_manual(values = c("gray", "black")) +
theme_bw()+
theme(axis.title.x = element_blank())
#| label: fig-hist_sci
#| fig-cap: Histogram of perceived scientificity of evidence
#| fig-width: 7
#| fig-height: 3
#|
#| fig-align: center
#| echo: false
#| warning: false
algsci_table<-table(merged_results$algsci)
algsci_df<-data.frame(algsci_table, question="algorithm")
examsci_table<-table(merged_results[merged_results$algorithm=="Yes",]$examsci)
examsci_df<- data.frame(examsci_table, question="examiner")
sci_df<-rbind(algsci_df, examsci_df)
levels(sci_df$Var1) <- gsub(" ", "\n", levels(sci_df$Var1))
sci_df$Var1=factor(sci_df$Var1, levels = c("Extremely\nunscientific","Moderately\nunscientific","Weakly\nunscientific",
"Neither\nscientific\nnor\nunscientific", "Weakly\nscientific", "Moderately\nscientific",
"Extremely\nscientific"))
ggplot(sci_df, aes(Var1, Freq, fill=question))+
geom_bar(stat="identity", position=position_dodge(preserve = "single"), color="black")+
ggtitle("How scientific do you think the ____ evidence is, in this case?")+
scale_fill_manual(values = c("gray", "black")) +
theme_bw()+
theme(axis.title.x = element_blank())
#| label: fig-hist_under
#| fig-cap: Histogram of participants' understanding
#| fig-width: 7
#| fig-height: 3
#|
#| fig-align: center
#| echo: false
#| warning: false
algunder_table<-table(merged_results$algunder)
algunder_df<-data.frame(algunder_table, question="algorithm")
expunder_table<-table(merged_results[merged_results$algorithm=="Yes",]$expunder)
expunder_df<- data.frame(expunder_table, question="examiner")
under_df<-rbind(algunder_df, expunder_df)
levels(under_df$Var1) <-
gsub("<br/>", "", levels(under_df$Var1))
levels(under_df$Var1) <-
gsub("  ", " ", levels(under_df$Var1))
levels(under_df$Var1) <- gsub(" ", "\n", levels(under_df$Var1))
ggplot(under_df, aes(Var1, Freq, fill=question))+
geom_bar(stat="identity", position=position_dodge(preserve = "single"), color="black")+
ggtitle("Based on this testimony, how would you rate your understanding of the method
described for the ______?") +
scale_fill_manual(values = c("gray", "black")) +
theme_bw()+
theme(axis.title.x = element_blank())+
scale_x_discrete(labels=c('1\nI\nunderstood\nnothing', '2', '3', '4', '5\nI\nunderstood\neverything'))
#| label: fig-coord_cred
#| fig-cap: Plots of understanding and perceived expert credibility
#| fig-width: 7
#| fig-height: 6
#|
#| fig-align: center
#| echo: false
#| warning: false
algtestcred_reorder<- algorithm_results %>% mutate(algtestcred=fct_relevel(algtestcred, "Extremely noncredible","Moderately noncredible",
"Weakly noncredible",
"Neither credible nor noncredible",
"Weakly credible", "Moderately credible",
"Extremely credible"))
algtestcred_reorder<- algorithm_results %>% mutate(firetestcred=fct_relevel(firetestcred, "Extremely noncredible","Moderately noncredible",
"Weakly noncredible",
"Neither credible nor noncredible",
"Weakly credible", "Moderately credible",
"Extremely credible"))
cred_data<-data.frame(algtestcred=algtestcred_reorder$algtestcred, firetestcred=algtestcred_reorder$firetestcred)
testcred_tab<-table(cred_data)
testcred_df<-as.data.frame(testcred_tab)
credplot<-ggparcoord(data=subset(testcred_df, Freq != 0), columns=c("algtestcred","firetestcred"), order=c(1,2,3,4,5,6,7), scale="globalminmax")+
geom_line(aes(linewidth=Freq, alpha=Freq))+
ggtitle("How credible did you find the \n testimony of the ___ expert?")+
facet_grid(drop=FALSE)
under_data<-data.frame(examiner=algorithm_results$expunder, algorithm=algorithm_results$algunder)
under_tab<-table(under_data)
under_df<-as.data.frame(under_tab)
under_df<-rbind(under_df, data.frame("examiner" = "2.0", "algorithm"=NA, "Freq"=NA))
levels(under_df$algorithm) <-
gsub("<br/>", "", levels(under_df$algorithm))
levels(under_df$algorithm) <-
gsub("  ", " ", levels(under_df$algorithm))
levels(under_df$algorithm) <- gsub(" ", "\n", levels(under_df$algorithm))
levels(under_df$examiner) <-
gsub("<br/>", "", levels(under_df$examiner))
levels(under_df$examiner) <-
gsub("  ", " ", levels(under_df$examiner))
levels(under_df$examiner) <- gsub(" ", "\n", levels(under_df$examiner))
under_df$examiner<- factor(under_df$examiner,
levels = c("1\nI\nunderstood\nnothing","2.0","3\nI\nunderstood\nabout\nhalf\nof\nthe\nmethod", "4.0", "5\nI\nunderstood\neverything"))
under_df$algorithm<- factor(under_df$algorithm, levels=
c("1\nI\nunderstood\nnothing","2.0","3\nI\nunderstood\nabout\nhalf\nof\nthe\nmethod", "4.0", "5\nI\nunderstood\neverything"))
underplot<- ggparcoord(data=subset(under_df, Freq != 0), columns=c("algorithm","examiner"), order=c(1,2,3,4,5,6,7), scale="globalminmax")+
geom_line(aes(linewidth=Freq, alpha=Freq))+
ggtitle("Based on this testimony, how would \n you rate your understanding of the \n method described for the ______?")+
facet_grid(drop=FALSE)
grid.arrange(credplot, underplot, ncol = 2)
#| label: fig-coord_scirel
#| fig-cap: Plots of perceived scientificity and reliability of methods
#| fig-width: 7
#| fig-height: 6
#|
#| fig-align: center
#| echo: false
#| warning: false
sci_reorder<- algorithm_results %>% mutate(algsci=fct_relevel(algsci, "Extremely unscientific","Moderately unscientific","Weakly unscientific",
"Neither scientific nor unscientific", "Weakly scientific", "Moderately scientific",
"Extremely scientific"))
sci_reorder<- algorithm_results %>% mutate(examsci=fct_relevel(examsci, "Extremely unscientific","Moderately unscientific","Weakly unscientific",
"Neither scientific nor unscientific", "Weakly scientific", "Moderately scientific",
"Extremely scientific"))
sci_data<-data.frame(examiner=sci_reorder$examsci, algorithm=sci_reorder$algsci)
sci_tab<-table(sci_data)
sci_df<-as.data.frame(sci_tab)
levels(sci_df$algorithm) <- gsub(" ", "\n", levels(sci_df$algorithm))
sciplot<- ggparcoord(data=subset(sci_df, Freq != 0), columns=c("algorithm","examiner"), order=c(1,2,3,4,5,6,7), scale="globalminmax")+
geom_line(aes(linewidth=Freq, alpha=Freq))+
ggtitle("How scientific do you think the ____ \n evidence is, in this case?")+
facet_grid(drop=FALSE)
algorithm_results<- rbind.fill(algorithm_results, data.frame("examrel"="Extremely unreliable"))
rel_reorder<- algorithm_results %>% mutate(algrel=fct_relevel(algrel, "Extremely unreliable","Moderately unreliable","Weakly unreliable", "Neither reliable nor unreliable", "Weakly reliable", "Moderately reliable",
"Extremely reliable"))
rel_reorder<- algorithm_results %>% mutate(examrel=fct_relevel(examrel, "Extremely unreliable", "Moderately unreliable","Weakly unreliable","Neither reliable nor unreliable", "Weakly reliable", "Moderately reliable",
"Extremely reliable"))
rel_data<-data.frame(examiner=rel_reorder$examrel, algorithm=rel_reorder$algrel)
rel_tab<-table(rel_data)
rel_df<-as.data.frame(rel_tab)
rel_df$algorithm <- factor(rel_df$algorithm, levels=
c( "Extremely unreliable", "Moderately unreliable","Weakly unreliable","Neither reliable nor unreliable", "Weakly reliable", "Moderately reliable",
"Extremely reliable"))
relplot<- ggparcoord(data=subset(rel_df, Freq != 0), columns=c("algorithm","examiner"), order=c(1,2,3,4,5,6,7), scale="globalminmax")+
geom_line(aes(linewidth=Freq, alpha=Freq))+
ggtitle("How reliable do you think the ____ \n evidence is, in this case?")+
facet_grid(drop=FALSE)
grid.arrange(sciplot, relplot, ncol = 2)
#| echo: false
#| warning: false
library(ggpcp)
algtestcred_reorder <- algorithm_results %>% mutate(conclusion = fct_relevel(conclusion, "NoMatch", "Inconclusive", "Match"))
cred_data2 <- data.frame(
algtestcred = algtestcred_reorder$algtestcred,
firetestcred = algtestcred_reorder$firetestcred,
conclusion = algtestcred_reorder$conclusion
)
testcred_tab2 <- table(cred_data2)
testcred_df2 <- as.data.frame(testcred_tab2)
testcred_df2 <- testcred_df2 %>%
purrr::map(.f = function(x) rep(x, testcred_df2$Freq)) %>%
as.data.frame() %>%
select(-Freq)
testcred_df2 %>%
pcp_select(algtestcred, firetestcred) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(aes(colour = conclusion), alpha = 1, boxwidth = 0.1) +
scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp( alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating)
names(select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating))
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp( alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp( alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(ase(), alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(aes(), alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(aes(x=breed), alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(aes(color=breed), alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,
`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence, `Amount of Shedding`, `General Health`,`Potential for Playfulness`) %>%
#, `Kid-Friendly`,`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(`Affectionate with Family`, Intelligence) %>%
#, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating) %>%
pcp_select(as.factor(`Affectionate with Family`), as.factor(Intelligence)) %>%
#, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
wide_df<-select(cat_df, breed, characteristics) %>% unnest(characteristics) %>% pivot_wider(names_from=characteristic, values_from = rating)
wide_df$`Affectionate with Family`<-as.factor(wide_df$`Affectionate with Family`)
wide_df$Intelligence<- as.factor(wide_df$Intelligence)
wide_df %>%
pcp_select(`Affectionate with Family`, Intelligence) %>%
#, `Amount of Shedding`, `General Health`,`Potential for Playfulness`, `Kid-Friendly`,`Easy to Groom`, `Intelligence`, `Pet Friendly`, `Tendency to Vocalize`, `Friendly Toward Strangers`) %>%
pcp_scale() %>%
pcp_arrange() %>%
ggplot(aes_pcp()) +
geom_pcp(alpha = 1, boxwidth = 0.1) +
#scale_colour_manual(values = c("orange", "ivory", "darkslategray4")) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
geom_pcp_boxes(fill = "transparent", color = "black", linewidth = 0.5) +
geom_pcp_labels()
library(readr)
library(tidyverse)
library(ggplot2)
library(ggpcp)
merged_results_allresponses<-read_csv("data/merged_results_clean.csv")
merged_results <- merged_results_allresponses %>% filter(check1 =="9mm" & check2 == "Moderately reliable")
merged_results$conclusion <-
factor(merged_results$conclusion,
levels = c("NoMatch", "Inconclusive", "Match"))
merged_results_allresponses<-read_csv("merged_results_clean.csv")
setwd(.)
setwd(dirname(getActiveDocumentContext()$path))
setwd(getSrcDirectory(function(){})[1])
getSrcDirectory(function(){})[1]
dirname(parent.frame(2)$ofile)
remotes::install_github(c("ropensci/tabulizerjars", "ropensci/tabulizer"), INSTALL_opts = "--no-multiarch")
usethis::edit_r_environ()
q()
install.pagkages("htmltools")
install.packages("htmltools")
install.packages("htmltools")
install.package("shiny")
install.packages("shiny")
install.packages("ggh4x")
install.packages("ggh4x")
library(rlang)
install.packages("rlang")
install.packages("rlang")
remove.packages("rlang")
install.packages("rlang")
.libPaths()
install.packages("rlang")
install.packages("installr")
library(installr)
updateR()
if (interactive() && requireNamespace("rmarkdown", quietly = TRUE)) {
## draft from a sample R markdown file
jds.rmd::draft("jds-sample.Rmd")
## produce pdf with the tex source kept for submission
rmarkdown::render("jds-sample.Rmd")
}
install.packages("gtsummary")
install.packages("gtsummary")
install.packages("gtsummary")
library(installr)
install.packages("bookdown")
install.packages("knitr")
install.packages("knitr")
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "antiword", "bayesplot", "bayestestR", "BIFIEsurvey", "brew", "brio", "callr", "checkmate", "chromote", "circlize", "cli", "coda", "collapse", "commonmark", "crosstalk", "curl", "data.table", "DBI", "DiagrammeR", "digest", "dplyr", "DT", "emmeans", "epiR", "estimability", "fansi", "fungible", "geoR", "gert", "GGally", "ggforce", "ggh4x", "ggrepel", "ggthemes", "git2r", "glue", "gplots", "gt", "gtools", "haven", "heplots", "HH", "htmlTable", "htmlwidgets", "httpuv", "httr2", "huxtable", "igraph", "ISOcodes", "kableExtra", "later", "latexdiffr", "lemon", "lubridate", "magick", "markdown", "MatrixModels", "merTools", "mets", "modelbased", "modelsummary", "mvtnorm", "NMF", "openxlsx2", "parallelly", "parsnip", "patchwork", "pdftools", "performance", "pkgbuild", "pkgload", "plotly", "plotrix", "plyr", "pool", "processx", "progress", "proxyC", "ps", "PTXQC", "qdapRegex", "quanteda.textstats", "quantmod", "R.rsp", "ragg", "Rcmdr", "Rcpp", "RcppArmadillo", "RCurl", "readr", "recipes", "refund", "reprex", "reticulate", "rJava", "rlang", "roxygen2", "rprojroot", "RSQLite", "rsvg", "rvest", "sandwich", "satellite", "see", "segmented", "seqinr", "servr", "setRNG", "shinyWidgets", "sm", "sp", "spatstat.data", "spatstat.explore", "spatstat.geom", "spatstat.linnet", "spatstat.model", "startupmsg", "stringdist", "stringi", "SuperLearner", "svglite", "systemfonts", "TAM", "tclust", "TeachingDemos", "terra", "textshaping", "thematic", "tidyr", "timechange", "tinysnapshot", "tinytable", "usethis", "utf8", "uuid", "V8", "vctrs", "venneuler", "viridis", "vroom", "waldo", "withr", "workflows", "writexl", "x3ptools", "xaringan", "XML", "xml2", "yulab.utils", "zip"))
install.packages(c("altdoc", "cli", "data.table", "digest", "dplyr", "fansi", "glue", "rlang", "tidyr", "utf8", "vctrs"))
library(cli)
detach("package:cli", unload = TRUE)
remove.packages("cli")
install.packages("cli")
install.packages(c("adbcdrivermanager", "admisc", "afex", "arrow", "bbotk", "bdsmatrix", "BMisc", "bookdown", "cobalt", "cobs", "constructive", "coro", "coxme", "crop", "curl", "data.table", "deldir", "dials", "dotwhisker", "earth", "eha", "FactoMineR", "fastshap", "fda", "flextable", "fmeffects", "forecast", "ftExtra", "fungible", "gdtools", "geomtextpath", "gganimate", "ggdag", "ggdendro", "ggdist", "ggeffects", "ggiraph", "ggpcp", "ggplot2", "ggraph", "ggsci", "ggside", "globals", "gmodels", "GPArotation", "graphlayouts", "grf", "hrbrthemes", "ipumsr", "kit", "lava", "lavaSearch2", "lfe", "locfit", "loo", "LPCM", "lwgeom", "mclust", "mlr3", "mlr3fselect", "mlr3hyperband", "mlr3mbo", "mlr3tuning", "mlr3tuningspaces", "mlr3viz", "mmrm", "mosaic", "multcompView", "nanoarrow", "officer", "ontologyIndex", "pammtools", "parallelly", "plotmo", "probably", "qrng", "qs", "quarto", "RcmdrPlugin.HH", "RcppArmadillo", "RcppEigen", "readtext", "renv", "rgl", "rmarkdown", "rpart.plot", "rstan", "RUnit", "runjags", "scam", "scdhlm", "sdmTMB", "shape", "shinytest", "shinyWidgets", "showtext", "smacof", "spatstat.geom", "spatstat.random", "spelling", "StanHeaders", "stringmagic", "survey", "sysfonts", "systemfonts", "targeted", "tidyclust", "transformr", "tweenr", "VGAM"))
install.packages(c("adbcdrivermanager", "admisc", "afex", "arrow", "bbotk", "bdsmatrix", "BMisc", "bookdown", "cobalt", "cobs", "constructive", "coro", "coxme", "crop", "curl", "data.table", "deldir", "dials", "dotwhisker", "earth", "eha", "FactoMineR", "fastshap", "fda", "flextable", "fmeffects", "forecast", "ftExtra", "fungible", "gdtools", "geomtextpath", "gganimate", "ggdag", "ggdendro", "ggdist", "ggeffects", "ggiraph", "ggpcp", "ggplot2", "ggraph", "ggsci", "ggside", "globals", "gmodels", "GPArotation", "graphlayouts", "grf", "hrbrthemes", "ipumsr", "kit", "lava", "lavaSearch2", "lfe", "locfit", "loo", "LPCM", "lwgeom", "mclust", "mlr3", "mlr3fselect", "mlr3hyperband", "mlr3mbo", "mlr3tuning", "mlr3tuningspaces", "mlr3viz", "mmrm", "mosaic", "multcompView", "nanoarrow", "officer", "ontologyIndex", "pammtools", "parallelly", "plotmo", "probably", "qrng", "qs", "quarto", "RcmdrPlugin.HH", "RcppArmadillo", "RcppEigen", "readtext", "renv", "rgl", "rmarkdown", "rpart.plot", "rstan", "RUnit", "runjags", "scam", "scdhlm", "sdmTMB", "shape", "shinytest", "shinyWidgets", "showtext", "smacof", "spatstat.geom", "spatstat.random", "spelling", "StanHeaders", "stringmagic", "survey", "sysfonts", "systemfonts", "targeted", "tidyclust", "transformr", "tweenr", "VGAM"))
install.packages(c("adbcdrivermanager", "admisc", "afex", "arrow", "bbotk", "bdsmatrix", "BMisc", "bookdown", "cobalt", "cobs", "constructive", "coro", "coxme", "crop", "curl", "data.table", "deldir", "dials", "dotwhisker", "earth", "eha", "FactoMineR", "fastshap", "fda", "flextable", "fmeffects", "forecast", "ftExtra", "fungible", "gdtools", "geomtextpath", "gganimate", "ggdag", "ggdendro", "ggdist", "ggeffects", "ggiraph", "ggpcp", "ggplot2", "ggraph", "ggsci", "ggside", "globals", "gmodels", "GPArotation", "graphlayouts", "grf", "hrbrthemes", "ipumsr", "kit", "lava", "lavaSearch2", "lfe", "locfit", "loo", "LPCM", "lwgeom", "mclust", "mlr3", "mlr3fselect", "mlr3hyperband", "mlr3mbo", "mlr3tuning", "mlr3tuningspaces", "mlr3viz", "mmrm", "mosaic", "multcompView", "nanoarrow", "officer", "ontologyIndex", "pammtools", "parallelly", "plotmo", "probably", "qrng", "qs", "quarto", "RcmdrPlugin.HH", "RcppArmadillo", "RcppEigen", "readtext", "renv", "rgl", "rmarkdown", "rpart.plot", "rstan", "RUnit", "runjags", "scam", "scdhlm", "sdmTMB", "shape", "shinytest", "shinyWidgets", "showtext", "smacof", "spatstat.geom", "spatstat.random", "spelling", "StanHeaders", "stringmagic", "survey", "sysfonts", "systemfonts", "targeted", "tidyclust", "transformr", "tweenr", "VGAM"))
install.packages(c("adbcdrivermanager", "admisc", "afex", "arrow", "bbotk", "bdsmatrix", "BMisc", "bookdown", "cobalt", "cobs", "constructive", "coro", "coxme", "crop", "curl", "data.table", "deldir", "dials", "dotwhisker", "earth", "eha", "FactoMineR", "fastshap", "fda", "flextable", "fmeffects", "forecast", "ftExtra", "fungible", "gdtools", "geomtextpath", "gganimate", "ggdag", "ggdendro", "ggdist", "ggeffects", "ggiraph", "ggpcp", "ggplot2", "ggraph", "ggsci", "ggside", "globals", "gmodels", "GPArotation", "graphlayouts", "grf", "hrbrthemes", "ipumsr", "kit", "lava", "lavaSearch2", "lfe", "locfit", "loo", "LPCM", "lwgeom", "mclust", "mlr3", "mlr3fselect", "mlr3hyperband", "mlr3mbo", "mlr3tuning", "mlr3tuningspaces", "mlr3viz", "mmrm", "mosaic", "multcompView", "nanoarrow", "officer", "ontologyIndex", "pammtools", "parallelly", "plotmo", "probably", "qrng", "qs", "quarto", "RcmdrPlugin.HH", "RcppArmadillo", "RcppEigen", "readtext", "renv", "rgl", "rmarkdown", "rpart.plot", "rstan", "RUnit", "runjags", "scam", "scdhlm", "sdmTMB", "shape", "shinytest", "shinyWidgets", "showtext", "smacof", "spatstat.geom", "spatstat.random", "spelling", "StanHeaders", "stringmagic", "survey", "sysfonts", "systemfonts", "targeted", "tidyclust", "transformr", "tweenr", "VGAM"))
library(devtools)
create_package("courtr")
setwd("~/PhD Research/Algs_Jury_Code_Proof")
options(tinytex.clean = FALSE)
# for reading in the data
library(readr)
# for data cleaning
library(tidyr)
library(plyr)
library(dplyr)
# for plotting/tables
library(ggplot2)
#library(ggblend)
library(patchwork)
library(gt)
library(reshape2)
# for statistical analysis
library(MASS)
library(VGAM)
library(emmeans)
library(mgcv)
knitr::opts_chunk$set(dpi = 300, echo = F, eval = T, message = F, warning=F, error = F, out.width = ".9\\textwidth")
# Reading in data
merged_results_allresponses<-read_csv("data/merged_results_clean.csv")
# Removing person who took notes for on the first page that did not correspond to their scenario number
merged_results_allresponses <-merged_results_allresponses %>% subset(clean_prints!=231)
# Removing those who did not pass the attention checks
merged_results <- merged_results_allresponses %>% filter(check1 =="9mm" & check2 == "Moderately reliable") %>% rename("Algorithm"="algorithm", "Conclusion"="conclusion", "Picture"="picture")
# Ordering the Conclusion Variable
merged_results$Conclusion <-
factor(merged_results$Conclusion,
levels = c("NoMatch", "Inconclusive", "Match"),
labels = c("Elimination", "Inconcl.", "Identification"))
# Reading in the demographic dataset
demographics <-
read_csv("data/demographic_clean.csv")
detach("package:dplyr", unload = TRUE)
detach("package:emmeans", unload = TRUE)
detach("package:ggplot2", unload = TRUE)
detach("package:gt", unload = TRUE)
detach("package:mgcv", unload = TRUE)
detach("package:patchwork", unload = TRUE)
detach("package:plyr", unload = TRUE)
detach("package:readr", unload = TRUE)
detach("package:reshape2", unload = TRUE)
detach("package:tidyr", unload = TRUE)
detach("package:VGAM", unload = TRUE)
detach("package:datasets", unload = TRUE)
library(datasets, lib.loc = "C:/Program Files/R/R-4.3.1/library")
# for reading in the data
library(readr)
# for data cleaning
library(tidyr)
library(plyr)
library(dplyr)
# for plotting/tables
library(ggplot2)
#library(ggblend)
library(patchwork)
library(reshape2)
# for statistical analysis
library(MASS)
library(VGAM)
library(mgcv)
knitr::opts_chunk$set(dpi = 300, echo = F, eval = T, message = F, warning=F, error = F, out.width = ".9\\textwidth")
# Reading in data
merged_results_allresponses<-read_csv("data/merged_results_clean.csv")
# Removing person who took notes for on the first page that did not correspond to their scenario number
merged_results_allresponses <-merged_results_allresponses %>% subset(clean_prints!=231)
# Removing those who did not pass the attention checks
merged_results <- merged_results_allresponses %>% filter(check1 =="9mm" & check2 == "Moderately reliable") %>% rename("Algorithm"="algorithm", "Conclusion"="conclusion", "Picture"="picture")
# Removing those who did not pass the attention checks
merged_results <- merged_results_allresponses %>% filter(check1 =="9mm" & check2 == "Moderately reliable") %>% dplyr::rename("Algorithm"="algorithm", "Conclusion"="conclusion", "Picture"="picture")
# Ordering the Conclusion Variable
merged_results$Conclusion <-
factor(merged_results$Conclusion,
levels = c("NoMatch", "Inconclusive", "Match"),
labels = c("Elimination", "Inconcl.", "Identification"))
# Reading in the demographic dataset
demographics <-
read_csv("data/demographic_clean.csv")
shiny::runApp('code/Survey_App')
runApp('code/Survey_App')
