#SCRIPT FORM-EE 
#AUTHOR: BENJAMIN RODRIGUEZ DIAZ (SESCS)
#LICENSE: Creative Commons Attribution 4.0 International

#WE USED R VERSION 4.3.3
#WE RECOMMEND USING RSTUDIO FOR EXECUTING THIS SCRIPT

#This script requires the following libraries: tidyverse, summarytools, likert, readxl, rstatix and vcd
#If these libraries are not installed, the script will install them automatically
#Installation may take a few minutes

#A folder called "graphs" will be created containing the graphs used in the paper

#Directory-----
######################################################
#MAKE SURE THE DATASETS ARE IN YOUR WORKING DIRECTORY#
######################################################
getwd() #shows your current directory
#use setwd() if you have to change the directory path e.g. setwd("C:/Documents/my/working/directory")

#Libraries we used-------------------
librerias <- c("tidyverse","summarytools","likert","readxl","rstatix","vcd")
librerias_instaladas <- librerias %in% installed.packages()
if (!all(librerias_instaladas)) {
  librerias_a_instalar <- librerias[!librerias_instaladas]
  install.packages(librerias_a_instalar)
}
lapply(librerias, library, character.only = TRUE)

#Theme for graphs-----------------------------------
theme_set(theme_bw())

#GENERAL POPULATION DATA---------------------------------
db_pobl <- read_excel("FORM-EE datos pobl gral.xlsx")
class(db_pobl)
db_pobl <- as.data.frame(db_pobl)

nrow(db_pobl)
colnames(db_pobl)
colSums(is.na(db_pobl))

#We delete variables with 100% missing data
db_pobl <- db_pobl[, colSums(is.na(db_pobl)) < nrow(db_pobl)]

##ID
db_pobl <- db_pobl %>% rename(ID = `ID de respuesta`)
n_distinct(db_pobl$ID)

##send date
db_pobl <- db_pobl %>% rename(fecha_envio = `Fecha de envío`)
db_pobl$fecha_envio <- as.Date(db_pobl$fecha_envio, format = "%Y-%m-%d %H")
freq(db_pobl$fecha_envio)

##last page
db_pobl <- db_pobl %>% rename(ult_pag = "Última página")
freq(db_pobl$ult_pag)

##questionnaire finished?
db_pobl$completo <- ifelse(db_pobl$ult_pag >= 10, 1, 0)
freq(db_pobl$completo)

##initial language
db_pobl <- db_pobl %>% rename(len_ini = `Lenguaje inicial`)
freq(db_pobl$len_ini)

##seed
n_distinct(db_pobl$Semilla)

##start date
db_pobl <- db_pobl %>% rename(fecha_inicio = `Fecha de inicio`)
db_pobl$fecha_inicio <- as.Date(db_pobl$fecha_inicio, format = "%Y-%m-%d %H")
freq(db_pobl$fecha_inicio)

##last action date
db_pobl <- db_pobl %>% rename(fecha_ult_acc = `Fecha de la última acción`)
db_pobl$fecha_ult_acc <- as.Date(db_pobl$fecha_ult_acc, format = "%Y-%m-%d %H")
freq(db_pobl$fecha_ult_acc)

##random
db_pobl$aleatorio <- NULL

##format
db_pobl$Condición <- as.factor(db_pobl$Condición)
freq(db_pobl$Condición)

##consent
db_pobl <- db_pobl %>% rename(consent = `Seleccione “Estoy de acuerdo” para indicar que:  (a) usted ha leído la información anterior,  (b) que voluntariamente está de a`)
freq(db_pobl$consent)

##saw
db_pobl <- db_pobl %>% rename(visto = `Por favor indique lo que ha visto y escuchado.  (He visto)`)
freq(db_pobl$visto) #people who saw the video

##listened
db_pobl <- db_pobl %>% rename(escuchado = `Por favor indique lo que ha visto y escuchado.  (He escuchado)`)
freq(db_pobl$escuchado) #people who saw the video

##device
db_pobl <- db_pobl %>% rename(dispositivo = `¿Desde qué dispositivo está respondiendo esta encuesta?`)
freq(db_pobl$dispositivo)
db_pobl$dispositivo[db_pobl$dispositivo == "Otro"] <- "Smartphone" #other option are smartphones
db_pobl$`¿Desde qué dispositivo está respondiendo esta encuesta? (Otro)` <- NULL

##DEMOGRAPHIC DATA--------------------------
###gender
freq(db_pobl$Género)

###age
summary(db_pobl$Edad)

###CCAA
db_pobl <- db_pobl %>% rename(CCAA = `Comunidad Autónoma/ Ciudad Autónoma:`)
freq(db_pobl$CCAA)

###study level
db_pobl <- db_pobl %>% rename(nivel_estudios = `Máximo nivel de estudios`)
freq(db_pobl$nivel_estudios)

##CONTEXT---------------------
###Professional background
####Healthcare
db_pobl <- db_pobl %>% rename(sanidad = `¿Su profesión está relacionada con las siguientes áreas?  Marque tantas como considere:  (Sanidad)`)
db_pobl$sanidad <- ifelse(db_pobl$sanidad == "Sí", 1, 0)
freq(db_pobl$sanidad)

####Research
db_pobl <- db_pobl %>% rename(investigacion = `¿Su profesión está relacionada con las siguientes áreas?  Marque tantas como considere:  (Investigación)`)
db_pobl$investigacion <- ifelse(db_pobl$investigacion == "Sí", 1, 0)
freq(db_pobl$investigacion)

####Economics
db_pobl <- db_pobl %>% rename(economia = `¿Su profesión está relacionada con las siguientes áreas?  Marque tantas como considere:  (Economía)`)
db_pobl$economia <- ifelse(db_pobl$economia == "Sí", 1, 0)
freq(db_pobl$economia)

####None
db_pobl <- db_pobl %>% rename(ninguna_ant = `¿Su profesión está relacionada con las siguientes áreas?  Marque tantas como considere:  (Ninguna de las anteriores)`)
db_pobl$ninguna_ant <- ifelse(db_pobl$ninguna_ant == "Sí", 1, 0)
freq(db_pobl$ninguna_ant)

###interested in health research info
db_pobl <- db_pobl %>% rename(interesado_inv = `¿Suele estar interesado en información relacionada con la investigación sanitaria o científica? (1)`)
db_pobl$interesado_inv <- as.numeric(gsub("[^0-9.]", "", db_pobl$interesado_inv))
freq(db_pobl$interesado_inv)

###Format types
####videos
db_pobl <- db_pobl %>% rename(videos = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere para que le presenten los resultados de investigaci`)
db_pobl$videos <- ifelse(db_pobl$videos == "Sí", 1, 0)
freq(db_pobl$videos)

####infographics
db_pobl <- db_pobl %>% rename(infografia = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Vídeos)`)
db_pobl$infografia <- ifelse(db_pobl$infografia == "Sí", 1, 0)
freq(db_pobl$infografia)

####audios
db_pobl <- db_pobl %>% rename(audios = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Infografías)`)
db_pobl$audios <- ifelse(db_pobl$audios == "Sí", 1, 0)
freq(db_pobl$audios)

####texts
db_pobl <- db_pobl %>% rename(textos = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Audios)`)
db_pobl$textos <- ifelse(db_pobl$textos == "Sí", 1, 0)
freq(db_pobl$textos)

####paper
db_pobl <- db_pobl %>% rename(articulo = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Texto)`)
db_pobl$articulo <- ifelse(db_pobl$articulo == "Sí", 1, 0)
freq(db_pobl$articulo)

##see video again
db_pobl <- db_pobl %>% rename(rep_video = `¿Quiere volver a ver el vídeo?`)
db_pobl$rep_video <- ifelse(db_pobl$rep_video == "Sí", 1, 0)
freq(db_pobl$rep_video)

##OBJECTIVE COMPREHENSION---------------------------
###study objective
db_pobl <- db_pobl %>% rename(objetivo_estudio = `El objetivo del estudio presentado era:`)
freq(db_pobl$objetivo_estudio)

###evaluated technique 1
db_pobl <- db_pobl %>% rename(tecnica_evaluada_1 = `La técnica evaluada (artroplastia de superficie):`)
freq(db_pobl$tecnica_evaluada_1)

###evaluated technique 2
db_pobl <- db_pobl %>% rename(tecnica_evaluada_2 = `La técnica evaluada (artroplastia de superficie): 1`)
freq(db_pobl$tecnica_evaluada_2)

###objective comprehension var
db_pobl$comprension_objetiva <- ifelse(db_pobl$objetivo_estudio == "Evaluar los costes y los beneficios de dos técnicas de la artroplastia de cadera", 1, 0) +
  ifelse(db_pobl$tecnica_evaluada_1 == "Aporta más beneficios y es más costosa que la artroplastia convencional", 1, 0) + 
  ifelse(db_pobl$tecnica_evaluada_2 == "Se recomienda solamente para pacientes menores de 65 años", 1, 0)
freq(db_pobl$comprension_objetiva)

##SUBJECTIVE COMPREHENSION---------------------
###subjective comprehension var
db_pobl <- db_pobl %>% rename(seguridad_respuesta = `¿Cuánto de seguro/a está de que sus respuestas son correctas?`)
db_pobl$seguridad_respuesta <- as.numeric(gsub("[^0-9.]", "", db_pobl$seguridad_respuesta))
freq(db_pobl$seguridad_respuesta)

##ACCEPTABILITY----------------
###format appearance
db_pobl <- db_pobl %>% rename(apariencia_formato = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Estoy satisfecho/a con la apariencia del formato que se le ha mostrado)`)
db_pobl$apariencia_formato <- as.numeric(gsub("[^0-9.]", "", db_pobl$apariencia_formato))
freq(db_pobl$apariencia_formato)

###more numeric data
db_pobl <- db_pobl %>% rename(mas_datos_numericos = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Entendería mejor la información si hubiese más datos numéricos)`)
db_pobl$mas_datos_numericos <- as.numeric(gsub("[^0-9.]", "", db_pobl$mas_datos_numericos))
freq(db_pobl$mas_datos_numericos)

###more explications
db_pobl <- db_pobl %>% rename(mas_explicaciones = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Entendería mejor la información si hubiese más explicaciones)`)
db_pobl$mas_explicaciones <- as.numeric(gsub("[^0-9.]", "", db_pobl$mas_explicaciones))
freq(db_pobl$mas_explicaciones)

###appropiate format
db_pobl <- db_pobl %>% rename(formato_adecuado = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que este formato de presentación es adecuado para este tipo de información)`)
db_pobl$formato_adecuado <- as.numeric(gsub("[^0-9.]", "", db_pobl$formato_adecuado))
freq(db_pobl$formato_adecuado)

###easy to remember
db_pobl <- db_pobl %>% rename(facil_recordar = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Fue fácil recordar la información para responder las preguntas del cuestionario)`)
db_pobl$facil_recordar <- as.numeric(gsub("[^0-9.]", "", db_pobl$facil_recordar))
freq(db_pobl$facil_recordar)

###understandable
db_pobl <- db_pobl %>% rename(info_comprensible = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que la información es comprensible para alguien sin conocimientos sobre este tema)`)
db_pobl$info_comprensible <- as.numeric(gsub("[^0-9.]", "", db_pobl$info_comprensible))
freq(db_pobl$info_comprensible)

###could explain
db_pobl <- db_pobl %>% rename(poder_explicar = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que yo podría explicar a alguien la información presentada)`)
db_pobl$poder_explicar <- as.numeric(gsub("[^0-9.]", "", db_pobl$poder_explicar))
freq(db_pobl$poder_explicar)

###little information to understand
db_pobl <- db_pobl %>% rename(poca_info_comp = `¿Cómo de acuerdo está con las siguientes afirmaciones? (No es posible comprender este tema con tan poca información)`)
db_pobl$poca_info_comp <- as.numeric(gsub("[^0-9.]", "", db_pobl$poca_info_comp))
freq(db_pobl$poca_info_comp)

###usefulness
db_pobl <- db_pobl %>% rename(utilidad_formato = `Valore la utilidad del formato que se le ha mostrado para comprender la información contenida en él. Por favor, marque una casi`)
db_pobl$utilidad_formato <- as.numeric(gsub("[^0-9.]", "", db_pobl$utilidad_formato))
freq(db_pobl$utilidad_formato)

#we delete useless vars
db_pobl[,41:102] <- NULL

#ANALYSIS BY FORMAT
db_pobl_completo <- db_pobl %>% filter(completo == 1)

#change format to english
db_pobl_completo$Condición <- case_when(db_pobl_completo$Condición == "Vídeo" ~ "Video abstract",
                                        db_pobl_completo$Condición == "Texto sencillo" ~ "Plain text",
                                        db_pobl_completo$Condición == "Infografía" ~ "Infographic")
freq(db_pobl_completo$Condición)


#PROFESSIONALS DATA---------------
db_prof <- read_excel("FORM-EE datos profesionales.xlsx")
class(db_prof)
db_prof <- as.data.frame(db_prof)

nrow(db_prof)
colnames(db_prof)
colSums(is.na(db_prof))

#We delete variables with 100% missing data
db_prof <- db_prof[, colSums(is.na(db_prof)) < nrow(db_prof)]

##Condition or format
db_prof$Condición <- as.factor(db_prof$Condición)
freq(db_prof$Condición)

##ID
db_prof <- db_prof %>% rename(ID = `ID de respuesta`)
n_distinct(db_prof$ID)
n_distinct(db_prof$`ID de respuesta-1`)
freq(db_prof$ID == db_prof$`ID de respuesta-1`)

#We drop second ID variable
db_prof$`ID de respuesta-1` <- NULL

##send date
db_prof <- db_prof %>% rename(fecha_envio = `Fecha de envío`)
db_prof$fecha_envio <- as.Date(db_prof$fecha_envio, format = "%Y-%m-%d %H")
freq(db_prof$fecha_envio) #16 missing

##last page
db_prof <- db_prof %>% rename(ultima_pag = 'Última página')
freq(db_prof$ultima_pag) #100/116 reached page 7

##questionnaire finished
db_prof$completo <- ifelse(db_prof$ultima_pag >= 6, 1, 0)
freq(db_prof$completo)

##initial language
db_prof <- db_prof %>% rename(len_ini = `Lenguaje inicial`)
freq(db_prof$len_ini) #all spanish

##seed
n_distinct(db_prof$Semilla)

##start date
db_prof <- db_prof %>% rename(fecha_inicio = `Fecha de inicio`)
db_prof$fecha_inicio <- as.Date(db_prof$fecha_inicio, format = "%Y-%m-%d %H")
freq(db_prof$fecha_inicio)

##last action date
db_prof <- db_prof %>% rename(fecha_ult_acc = `Fecha de la última acción`)
db_prof$fecha_ult_acc <- as.Date(db_prof$fecha_ult_acc, format = "%Y-%m-%d %H")
freq(db_prof$fecha_ult_acc)

##phase
freq(db_prof$Fase)

##consent
db_prof <- db_prof %>% rename(consent = `Seleccione “Estoy de acuerdo” para indicar que:  (a) usted ha leído la información anterior,  (b) que voluntariamente está de a`)
freq(db_prof$consent)

##device
db_prof <- db_prof %>% rename(dispositivo = `¿Desde qué dispositivo está respondiendo esta encuesta?`)
freq(db_prof$dispositivo)

##DEMOGRAPHIC DATA----------------------------
###Gender
freq(db_prof$Género)

###Age
freq(db_prof$Edad)
summary(db_prof$Edad) #person with 99 could be a missing data

###Community
db_prof <- db_prof %>% rename(CCAA = `Comunidad Autónoma/ Ciudad Autónoma:`)
freq(db_prof$CCAA)

###Professional profile
####Clinician
db_prof <- db_prof %>% rename(clinico = `Perfil profesional. Marque tantos como considere: (Clínico)`)
db_prof$clinico <- ifelse(db_prof$clinico == "Sí", 1, 0)
freq(db_prof$clinico)

####Non-clinical manager
db_prof <- db_prof %>% rename(gestor_no_clinico = `Perfil profesional. Marque tantos como considere: (Gestor no clínico (ej. gerente de AP, director médico o gerente) )`)
db_prof$gestor_no_clinico <- ifelse(db_prof$gestor_no_clinico == "Sí", 1, 0)
freq(db_prof$gestor_no_clinico)

####Clinical manager
db_prof <- db_prof %>% rename(gestor_clinico = `Perfil profesional. Marque tantos como considere: (Gestor clínico (ej. director de centro de salud, jefe de servicio))`)
db_prof$gestor_clinico <- ifelse(db_prof$gestor_clinico == "Sí", 1, 0)
freq(db_prof$gestor_clinico)

####Methodologist in HTA
db_prof <- db_prof %>% rename(metodologo_ets = `Perfil profesional. Marque tantos como considere: (Metodólogos de evaluación de tecnologías sanitarias (ETS))`)
db_prof$metodologo_ets <- ifelse(db_prof$metodologo_ets == "Sí", 1, 0)
freq(db_prof$metodologo_ets)

##CONTEXT-------------------------------
###Easy to understand economic information
db_prof <- db_prof %>% rename(facil_entender = `¿Considera que, generalmente, la información económica sobre tecnologías sanitarias es fácil de entender? (1)`)
db_prof$facil_entender <- as.numeric(gsub("[^0-9.]", "", db_prof$facil_entender))
freq(db_prof$facil_entender)

###Format types
####Video
db_prof <- db_prof %>% rename(formato_videos = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere para que le presenten los resultados de investigaci`)
db_prof$formato_videos <- ifelse(db_prof$formato_videos == "Sí", 1, 0)
freq(db_prof$formato_videos)

####Infographic
db_prof <- db_prof %>% rename(formato_infografia = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Vídeos)`)
db_prof$formato_infografia <- ifelse(db_prof$formato_infografia == "Sí", 1, 0)
freq(db_prof$formato_infografia)

####Audio
db_prof <- db_prof %>% rename(formato_audios = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Infografías)`)
db_prof$formato_audios <- ifelse(db_prof$formato_audios == "Sí", 1, 0)
freq(db_prof$formato_audios)

####Text
db_prof <- db_prof %>% rename(formato_texto = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Audios)`)
db_prof$formato_texto <- ifelse(db_prof$formato_texto == "Sí", 1, 0)
freq(db_prof$formato_texto)

####Scientific paper
db_prof <- db_prof %>% rename(formato_articulo = `¿Cuáles son los tipos de formato a los que está acostumbrado o que prefiere? (Texto)`)
db_prof$formato_articulo <- ifelse(db_prof$formato_articulo == "Sí", 1, 0)
freq(db_prof$formato_articulo)

##OBJECTIVE COMPREHENSION-------------------------
###study objective
db_prof <- db_prof %>% rename(objetivo_estudio = `El objetivo del estudio presentado era:`)
freq(db_prof$objetivo_estudio)

###outcome measure
db_prof <- db_prof %>% rename(medida_resultados = `La medida de resultados del análisis de coste-efectividad es:`)
freq(db_prof$medida_resultados)

###evaluated technique
db_prof <- db_prof %>% rename(tecnica_evaluada = `La técnica evaluada (artroplastia de superficie), en comparación con la artroplastia convencional:`)
freq(db_prof$tecnica_evaluada)

###objective comprehension variable
db_prof$comprension_objetiva <- ifelse(db_prof$objetivo_estudio == "Comparar los costes y los beneficios de dos técnicas de la artroplastia de cadera", 1, 0) +
                                ifelse(db_prof$medida_resultados == "La ratio de coste-efectividad incremental", 1, 0) + 
                                ifelse(db_prof$tecnica_evaluada == "Tiene una alta probabilidad de ser coste-efectiva para pacientes menores de 65 años", 1, 0)
freq(db_prof$comprension_objetiva)

##SUBJECTIVE COMPREHENSION------------------------------
###subjective comprehension variable
db_prof <- db_prof %>% rename(comprension_subjetiva = `¿Cuánto de seguro/a está de que sus respuestas son correctas?`)
db_prof$comprension_subjetiva <- as.numeric(gsub("[^0-9.]", "", db_prof$comprension_subjetiva))
freq(db_prof$comprension_subjetiva)  

##ACCEPTABILITY-----------------------------
###format appearance
db_prof <- db_prof %>% rename(apariencia_formato = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Estoy satisfecho/a con la apariencia del formato que se le ha mostrado)`)
db_prof$apariencia_formato <- as.numeric(gsub("[^0-9.]", "", db_prof$apariencia_formato))
freq(db_prof$apariencia_formato)

###more numeric data
db_prof <- db_prof %>% rename(mas_datos_numericos = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Entendería mejor la información si hubiese más datos numéricos)`)
db_prof$mas_datos_numericos <- as.numeric(gsub("[^0-9.]", "", db_prof$mas_datos_numericos))
freq(db_prof$mas_datos_numericos)

###more explications
db_prof <- db_prof %>% rename(mas_explicaciones = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Entendería mejor la información si hubiese más explicaciones)`)
db_prof$mas_explicaciones <- as.numeric(gsub("[^0-9.]", "", db_prof$mas_explicaciones))
freq(db_prof$mas_explicaciones)

###less data/explications
db_prof <- db_prof %>% rename(menos_explicaciones = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que este formato de presentación es adecuado para este tipo de información)`)
db_prof$menos_explicaciones <- as.numeric(gsub("[^0-9.]", "", db_prof$menos_explicaciones))
freq(db_prof$menos_explicaciones)

###appropriate format
db_prof <- db_prof %>% rename(formato_adecuado = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Fue fácil recordar la información para responder las preguntas del cuestionario)`)
db_prof$formato_adecuado <- as.numeric(gsub("[^0-9.]", "", db_prof$formato_adecuado))
freq(db_prof$formato_adecuado)

###easy to remember
db_prof <- db_prof %>% rename(facil_recordar = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que la información es comprensible para alguien sin conocimientos sobre este tema)`)
db_prof$facil_recordar <- as.numeric(gsub("[^0-9.]", "", db_prof$facil_recordar))
freq(db_prof$facil_recordar)

###understandable info
db_prof <- db_prof %>% rename(info_comprensible = `¿Cómo de acuerdo está con las siguientes afirmaciones? (Pienso que yo podría explicar a alguien la información presentada)`)
db_prof$info_comprensible <- as.numeric(gsub("[^0-9.]", "", db_prof$info_comprensible))
freq(db_prof$info_comprensible)

###sufficient for decision making
db_prof <- db_prof %>% rename(suf_toma_decisiones = `¿Cómo de acuerdo está con las siguientes afirmaciones? (No es posible comprender este tema con tan poca información)`)
db_prof$suf_toma_decisiones <- as.numeric(gsub("[^0-9.]", "", db_prof$suf_toma_decisiones))
freq(db_prof$suf_toma_decisiones)

###format utility
db_prof <- db_prof %>% rename(utilidad_formato = `Valore la utilidad del formato que se le ha mostrado para comprender la información contenida en él. Por favor, marque una casi`)
db_prof$utilidad_formato <- as.numeric(gsub("[^0-9.]", "", db_prof$utilidad_formato))
freq(db_prof$utilidad_formato)

#We delete useless variables
db_prof[,c(31:55,63:67)] <- NULL

#ANALYSIS BY FORMAT
db_prof_completo <- db_prof %>% filter(completo == 1) #complete professionals database

#change format to english
db_prof_completo$Condición <- case_when(db_prof_completo$Condición == "Resumen ejecutivo" ~ "Executive summary",
                                        TRUE ~ db_prof_completo$Condición)


#ARTICLE TABLES---------------------------------------------------------------------------------------------------------------------------

##ARTICLE TABLE 1 [GENERAL POPULATION]------------------

##Gender
db_pobl_completo %>% group_by(Condición) %>% freq(Género)
prop.test(c(67,64,54),c(120,114,90))

##Age
by(db_pobl_completo$Edad,db_pobl_completo$Condición,summary)
by(db_pobl_completo$Edad,db_pobl_completo$Condición,sd)
anova(lm(Edad ~ Condición, data = db_pobl_completo))

##Educational level
db_pobl_completo %>% group_by(Condición) %>% freq(nivel_estudios)
prop.test(c(1,0,1),c(120,114,90))
prop.test(c(2,4,2),c(120,114,90))
prop.test(c(37,39,33),c(120,114,90))
prop.test(c(80,71,54),c(120,114,90))

##Background
db_pobl_completo %>% group_by(Condición) %>% freq(sanidad)
prop.test(c(13,19,10),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(investigacion)
prop.test(c(7,6,5),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(economia)
prop.test(c(15,16,5),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(ninguna_ant)
prop.test(c(87,77,71),c(120,114,90))

##Interested in information
db_pobl_completo$interesado_inv <- case_when(db_pobl_completo$interesado_inv == 0 | db_pobl_completo$interesado_inv == 25 ~ "No or little",
                                             db_pobl_completo$interesado_inv == 50 ~ "More or less",
                                             db_pobl_completo$interesado_inv == 75 | db_pobl_completo$interesado_inv == 100 ~ "Yes, or very much")
db_pobl_completo$interesado_inv <- factor(db_pobl_completo$interesado_inv, levels = c("No or little","More or less","Yes, or very much"), ordered = T)
db_pobl_completo %>% group_by(Condición) %>% freq(interesado_inv)
kruskal.test(interesado_inv ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, interesado_inv ~ Condición)

##Preferred formats
db_pobl_completo %>% group_by(Condición) %>% freq(videos)
prop.test(c(78,73,70),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(infografia)
prop.test(c(60,58,48),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(audios)
prop.test(c(43,22,34),c(120,114,90))
pairwise.prop.test(c(43,22,34),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(textos)
prop.test(c(55,60,51),c(120,114,90))
db_pobl_completo %>% group_by(Condición) %>% freq(articulo)
prop.test(c(37,33,27),c(120,114,90))

##ARTICLE TABLE 2 [PROFESSIONALS]-------------------
##Gender
db_prof_completo %>% group_by(Condición) %>% freq(Género)
prop.test(c(27,30),c(46,54))

##Age
by(db_prof_completo$Edad, db_prof_completo$Condición, summary)
by(db_prof_completo$Edad, db_prof_completo$Condición, sd)
t.test(Edad ~ Condición, data = db_prof_completo)

##Profile
db_prof_completo %>% group_by(Condición) %>% freq(clinico)
prop.test(c(28,24),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(gestor_no_clinico)
prop.test(c(5,12),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(gestor_clinico)
prop.test(c(8,5),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(metodologo_ets)
prop.test(c(7,16),c(46,54))

##Easy to understand
db_prof_completo$facil_entender <- case_when(db_prof_completo$facil_entender == 0 | db_prof_completo$facil_entender == 25 ~ "No or little understandable",
                                             db_prof_completo$facil_entender == 50 ~ "More or less understandable",
                                             db_prof_completo$facil_entender == 75 | db_prof_completo$facil_entender == 100 ~ "Enough or completely understandable")
db_prof_completo$facil_entender <- factor(db_prof_completo$facil_entender, levels = c("No or little understandable","More or less understandable","Enough or completely understandable"), ordered = T)
db_prof_completo %>% group_by(Condición) %>% freq(facil_entender)
kruskal.test(facil_entender ~ Condición, data = db_prof_completo)

##Preferred formats
db_prof_completo %>% group_by(Condición) %>% freq(formato_videos)
prop.test(c(12,13),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(formato_infografia)
prop.test(c(23,30),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(formato_audios)
prop.test(c(3,6),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(formato_texto)
prop.test(c(27,32),c(46,54))
db_prof_completo %>% group_by(Condición) %>% freq(formato_articulo)
prop.test(c(35,40),c(46,54))

##ARTICLE TABLE 3---------------------------------------------------------
###GENERAL POPULATION PART----------------
###Objective comprehension
db_pobl_completo$comprension_objetiva <- factor(db_pobl_completo$comprension_objetiva, levels = c(0,1,2,3), ordered = T)
db_pobl_completo %>% group_by(Condición) %>% freq(comprension_objetiva)
kruskal.test(comprension_objetiva ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, comprension_objetiva ~ Condición)

###Subjective comprehension
db_pobl_completo$seguridad_respuesta <- factor(db_pobl_completo$seguridad_respuesta, levels = c(0,25,50,75,100), ordered = T)
db_pobl_completo %>% group_by(Condición) %>% freq(seguridad_respuesta)
kruskal.test(seguridad_respuesta ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, seguridad_respuesta ~ Condición)

###SPECIALIZED POPULATION PART------------------
###Objective comprehension
db_prof_completo$comprension_objetiva <- factor(db_prof_completo$comprension_objetiva, levels = c(0,1,2,3), ordered = T)
db_prof_completo %>% group_by(Condición) %>% freq(comprension_objetiva)
kruskal.test(comprension_objetiva ~ Condición, data = db_prof_completo)

###Subjective comprehension
db_prof_completo$comprension_subjetiva <- factor(db_prof_completo$comprension_subjetiva, levels = c(0,25,50,75,100), ordered = T)
db_prof_completo %>% group_by(Condición) %>% freq(comprension_subjetiva)
kruskal.test(comprension_subjetiva ~ Condición, data = db_prof_completo)

##ARTICLE TABLE 4 -------------------------------------------------------
###GENERAL POPULATION PART------------------
db_pobl_completo$utilidad_formato <- factor(db_pobl_completo$utilidad_formato, levels = c(0,25,50,75,100), ordered = TRUE)
db_pobl_completo %>% group_by(Condición) %>% freq(utilidad_formato)
kruskal.test(utilidad_formato ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, utilidad_formato ~ Condición)

###SPECIALIZED POPULATION PART------------------------
db_prof_completo$utilidad_formato <- factor(db_prof_completo$utilidad_formato, levels = c(0,25,50,75,100), ordered = T)
db_prof_completo %>% group_by(Condición) %>% freq(utilidad_formato)
kruskal.test(utilidad_formato ~ Condición, data = db_prof_completo)


#ARTICLE FIGURES---------------------------------------------------------------------------------------------------------------------------
dir.create("graphs") #we create a folder for graphs
dir.create("graphs/general population") #folder for general population graphs
dir.create("graphs/professionals") #folder for professionals graphs

##ARTICLE FIGURE 2 (General population likert graph)--------------
db_pobl_completo[,32:39] <- lapply(db_pobl_completo[,32:39], function(x) as.factor(x))

colnames(db_pobl_completo)[32:39] <- c("A1 - I am satisfied with the appearance of the format *",
                                       "A2 - I would understand better the information with more numeric data",
                                       "A3 – I would understand better the information with more explications",
                                       "A4 – I think that the format is appropriate for this type of information *",
                                       "A5 – It was easy to remember the information to answer the questions",
                                       "A6 – I think that the information is understandable for someone with no knowledge of this topic",
                                       "A7 – I think that I could explain to somebody the presented information",
                                       "A8 – It is not possible to understand the topic with so little information")


png("graphs/general population/likert_pobl.png", units = "in", width = 12, height = 9, res = 500)
plot(likert(db_pobl_completo[,32:39], grouping = db_pobl_completo[,"Condición"]), legend.position = "right") +
  scale_fill_manual(values = c("red1","darkorange","grey","palegreen","palegreen4"),
                    name = "¿Do you agree?",
                    labels = c("Not at all","Rather not","Neither agree nor disagree","Rather yes ","Completely agree")) +
  theme(text = element_text(size = 14))
dev.off()

##ARTICLE FIGURE 3 (professionals likert graph)-----------------
db_prof_completo[,22:29] <- lapply(db_prof_completo[,22:29], function(x) as.factor(x))

colnames(db_prof_completo)[22:29] <- c("B1 - I am satisfied with the appearance of the format",
                                       "B2 - I would understand better the information with more numeric data",
                                       "B3 – I would understand better the information with more explications",
                                       "B4 – I think that less data/explications would be enough to understand the conclusions of the study",
                                       "B5 – I think that the format is appropriate for this type of information *",
                                       "B6 – It was easy to remember the information to answer the questions *",
                                       "B7 – I think that the information is understandable for someone with no knowledge of economic evaluations *",
                                       "B8 – I think that this information is sufficient for decision making")

png("graphs/professionals/likert_prof.png", units = "in", width = 12, height = 9, res = 500)
plot(likert(db_prof_completo[,22:29], grouping = db_prof_completo[,"Condición"]), legend.position = "right") +
  scale_fill_manual(values = c("red1","darkorange","grey","palegreen","palegreen4"),
                    name = "¿Do you agree?",
                    labels = c("Not at all","Rather not","Neither agree nor disagree","Rather yes ","Completely agree")) +
  theme(text = element_text(size = 14))
dev.off()

##ARTICLE FIGURE 4 (Objective-subjective comprehension [GENERAL POPULATION])-----------------------
chisq.test(table(as.numeric(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Infographic"]), as.numeric(db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Infographic"])))
assocstats(table(as.numeric(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Infographic"]), as.numeric(db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Infographic"])))
chisq.test(table(as.numeric(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Plain text"]), as.numeric(db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Plain text"])))
assocstats(table(as.numeric(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Plain text"]), as.numeric(db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Plain text"])))
chisq.test(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Video abstract"], db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Video abstract"]))
assocstats(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Video abstract"], db_pobl_completo$seguridad_respuesta[db_pobl_completo$Condición == "Video abstract"]))

png("graphs/general population/comp_obj_subj_pobl.png", units = "in", width = 10, height = 9, res = 300)
db_pobl_completo %>% 
  count(comprension_objetiva, seguridad_respuesta, Condición) %>% 
  complete(comprension_objetiva, seguridad_respuesta, Condición, fill = list(n = 0)) %>%  
  as.data.frame() %>%
  mutate(prop = ifelse(Condición == "Infographic", round(n/120*100,1), ifelse(Condición == "Plain text", round(n/114*100,1), round(n/90*100,1)))) %>%
  ggplot(aes(x = comprension_objetiva, y = factor(seguridad_respuesta))) +
  geom_tile(aes(fill = prop), color = "white") +
  geom_text(aes(label = prop), color = "black", size = 6, nudge_x = -0.01, nudge_y = -0.01) +
  geom_text(aes(label = prop), color = "white", size = 6) +
  facet_grid(~ Condición) + 
  scale_fill_gradient(low = "#0251A9", high = "#FF9A00", limits = c(0,45)) +
  labs(x = "V = 0.266**               V = 0.389***             V = 0.354*** \n Objective comprehension",
       y = "Subjective comprehension",
       fill = "Proportion") +
  theme(text = element_text(size = 20))
dev.off()

##ARTICLE FIGURE 5 (Objective-subjective comprehension [PROFESSIONALS])--------------------
chisq.test(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Executive summary"]), as.numeric(db_prof_completo$comprension_subjetiva[db_prof_completo$Condición == "Executive summary"])))
assocstats(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Executive summary"]), as.numeric(db_prof_completo$comprension_subjetiva[db_prof_completo$Condición == "Executive summary"])))
chisq.test(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Policy brief"]), as.numeric(db_prof_completo$comprension_subjetiva[db_prof_completo$Condición == "Policy brief"])))
assocstats(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Policy brief"]), as.numeric(db_prof_completo$comprension_subjetiva[db_prof_completo$Condición == "Policy brief"])))

png("graphs/professionals/comp_obj_subj_formats.png", units = "in", width = 10, height = 9, res = 300)
db_prof_completo %>% 
  count(comprension_objetiva, comprension_subjetiva, Condición) %>% 
  complete(comprension_objetiva, comprension_subjetiva, Condición, fill = list(n = 0)) %>%  
  as.data.frame() %>% 
  mutate(prop = ifelse(Condición == "Executive summary", round(n/54*100,1), round(n/46*100,1))) %>% 
  ggplot(aes(x = comprension_objetiva, y = factor(comprension_subjetiva))) +
  geom_tile(aes(fill = prop), color = "white") +
  geom_text(aes(label = prop), color = "black", size = 6, nudge_x = -0.01, nudge_y = -0.01) +
  geom_text(aes(label = prop), color = "white", size = 6) +
  facet_grid(~ Condición) + 
  scale_fill_gradient(low = "#400760", high = "#EFEF54", limits = c(0,52)) +
  labs(x = "V = 0.336                               V = 0.434** \n Objective comprehension",
       y = "Subjective comprehension",
       fill = "Proportion") +
  theme(text = element_text(size = 20))
dev.off()


##ARTICLE FIGURE 6 (Objective comprehension - Usefulness of the format [GENERAL POPULATION])--------------------
chisq.test(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Infographic"],db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Infographic"]))
assocstats(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Infographic"],db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Infographic"]))
chisq.test(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Plain text"],as.numeric(db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Plain text"])))
assocstats(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Plain text"],as.numeric(db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Plain text"])))
chisq.test(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Video abstract"],db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Video abstract"]))
assocstats(table(db_pobl_completo$comprension_objetiva[db_pobl_completo$Condición == "Video abstract"],db_pobl_completo$utilidad_formato[db_pobl_completo$Condición == "Video abstract"]))

png("graphs/general population/comp_obj_util_pobl.png", units = "in", width = 10, height = 9, res = 300)
db_pobl_completo %>% 
  count(comprension_objetiva, utilidad_formato, Condición) %>% 
  complete(comprension_objetiva, utilidad_formato, Condición, fill = list(n = 0)) %>%  
  as.data.frame() %>%
  mutate(prop = ifelse(Condición == "Infographic", round(n/120*100,1), ifelse(Condición == "Plain text", round(n/114*100,1), round(n/90*100,1)))) %>%
  ggplot(aes(x = comprension_objetiva, y = factor(utilidad_formato))) +
  geom_tile(aes(fill = prop), color = "white") +
  geom_text(aes(label = prop), color = "black", size = 6, nudge_x = -0.01, nudge_y = -0.01) +
  geom_text(aes(label = prop), color = "white", size = 6) +
  facet_grid(~ Condición) + 
  scale_fill_gradient(low = "#0251A9", high = "#FF9A00", limits = c(0,45)) +
  labs(x = "V = 0.274**              V = 0.329***              V = 0.298* \n Objective comprehension",
       y = "Usefulness of the format",
       fill = "Proportion") +
  theme(text = element_text(size = 20))
dev.off()

##ARTICLE FIGURE 7 (Objective comprehension - Usefulness of the format [PROFESSIONALS])-----------------------------
chisq.test(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Executive summary"]), as.numeric(db_prof_completo$utilidad_formato[db_prof_completo$Condición == "Executive summary"])))
assocstats(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Executive summary"]), as.numeric(db_prof_completo$utilidad_formato[db_prof_completo$Condición == "Executive summary"])))
chisq.test(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Policy brief"]), as.numeric(db_prof_completo$utilidad_formato[db_prof_completo$Condición == "Policy brief"])))
assocstats(table(as.numeric(db_prof_completo$comprension_objetiva[db_prof_completo$Condición == "Policy brief"]), as.numeric(db_prof_completo$utilidad_formato[db_prof_completo$Condición == "Policy brief"])))

png("graphs/professionals/comp_obj_util.png", units = "in", width = 10, height = 9, res = 300)
db_prof_completo %>% 
  count(comprension_objetiva, utilidad_formato, Condición) %>% 
  complete(comprension_objetiva, utilidad_formato, Condición, fill = list(n = 0)) %>% 
  as.data.frame() %>% 
  mutate(prop = ifelse(Condición == "Executive summary", round(n/54*100,1), round(n/46*100,1))) %>% 
  ggplot(aes(x = comprension_objetiva, y = factor(utilidad_formato))) +
  geom_tile(aes(fill = prop), color = "white") +
  geom_text(aes(label = prop), color = "black", size = 6, nudge_x = -0.01, nudge_y = -0.01) +
  geom_text(aes(label = prop), color = "white", size = 6) +
  facet_grid(~ Condición) + 
  scale_fill_gradient(low = "#400760", high = "#EFEF54", limits = c(0,52)) +
  labs(x = "V = 0.186                               V = 0.312 \n Objective comprehension",
       y = "Usefulness of the format",
       fill = "Proportion") +
  theme(text = element_text(size = 20))
dev.off()


#SUPPLEMENTARY INFORMATION------------------------------
#S1. Influence of professional background / profile on comprehension------------------------
##S1A. General population-------------------------------------------------------------------
###Objective comprehension by profession profile--------------------------------------------
db_pobl_completo %>% filter(sanidad == 1) %>% freq(comprension_objetiva)
db_pobl_completo %>% filter(investigacion == 1) %>% freq(comprension_objetiva)
db_pobl_completo %>% filter(economia == 1) %>% freq(comprension_objetiva)
db_pobl_completo %>% filter(ninguna_ant == 1) %>% freq(comprension_objetiva)
kruskal.test(c_obj ~ pro, data = data.frame(c_obj = c(db_pobl_completo$comprension_objetiva[db_pobl_completo$sanidad == 1],
                                                      db_pobl_completo$comprension_objetiva[db_pobl_completo$investigacion == 1],
                                                      db_pobl_completo$comprension_objetiva[db_pobl_completo$economia == 1],
                                                      db_pobl_completo$comprension_objetiva[db_pobl_completo$ninguna_ant == 1]),
                                            pro = c(rep("Healhcare",42),rep("Research",18),rep("Economics",36),rep("None",235))))

###Subjective comprehension by professional background--------------------------------------
db_pobl_completo %>% filter(sanidad == 1) %>% freq(seguridad_respuesta)
db_pobl_completo %>% filter(investigacion == 1) %>% freq(seguridad_respuesta)
db_pobl_completo %>% filter(economia == 1) %>% freq(seguridad_respuesta)
db_pobl_completo %>% filter(ninguna_ant == 1) %>% freq(seguridad_respuesta)
kruskal.test(c_sub ~ pro, data = data.frame(c_sub = c(db_pobl_completo$seguridad_respuesta[db_pobl_completo$sanidad == 1],
                                                      db_pobl_completo$seguridad_respuesta[db_pobl_completo$investigacion == 1],
                                                      db_pobl_completo$seguridad_respuesta[db_pobl_completo$economia == 1],
                                                      db_pobl_completo$seguridad_respuesta[db_pobl_completo$ninguna_ant == 1]),
                                            pro = c(rep("Healhcare",42),rep("Research",18),rep("Economics",36),rep("None",235))))

##S1B. Specialized population---------------------------------------------------------------
###Objective comprehension by professional profile------------------------------------------
db_prof_completo %>% filter(clinico == 1) %>% freq(comprension_objetiva)
db_prof_completo %>% filter(gestor_no_clinico == 1) %>% freq(comprension_objetiva)
db_prof_completo %>% filter(gestor_clinico == 1) %>% freq(comprension_objetiva)
db_prof_completo %>% filter(metodologo_ets == 1) %>% freq(comprension_objetiva)
kruskal.test(c_obj ~ pro, data = data.frame(c_obj = c(db_prof_completo$comprension_objetiva[db_prof_completo$clinico == 1],
                                                      db_prof_completo$comprension_objetiva[db_prof_completo$gestor_no_clinico == 1],
                                                      db_prof_completo$comprension_objetiva[db_prof_completo$gestor_clinico == 1],
                                                      db_prof_completo$comprension_objetiva[db_prof_completo$metodologo_ets == 1]),
                                            pro = c(rep("Clinicial",52),rep("Non-clinical manager",17),rep("Clinical manager",13),rep("Methodologist",23))))

###Subjective comprehension by professional profile-----------------------------------------
db_prof_completo %>% filter(clinico == 1) %>% freq(comprension_subjetiva)
db_prof_completo %>% filter(gestor_no_clinico == 1) %>% freq(comprension_subjetiva)
db_prof_completo %>% filter(gestor_clinico == 1) %>% freq(comprension_subjetiva)
db_prof_completo %>% filter(metodologo_ets == 1) %>% freq(comprension_subjetiva)
kruskal.test(c_obj ~ pro, data = data.frame(c_obj = c(db_prof_completo$comprension_subjetiva[db_prof_completo$clinico == 1],
                                                      db_prof_completo$comprension_subjetiva[db_prof_completo$gestor_no_clinico == 1],
                                                      db_prof_completo$comprension_subjetiva[db_prof_completo$gestor_clinico == 1],
                                                      db_prof_completo$comprension_subjetiva[db_prof_completo$metodologo_ets == 1]),
                                            pro = c(rep("Clinicial",52),rep("Non-clinical manager",17),rep("Clinical manager",13),rep("Methodologist",23))))

#S2. Additional questions on usefulness and acceptability-----------------------------------
##S2A. Participant-reported satisfaction and acceptability. General population--------------
db_pobl_completo %>% group_by(Condición) %>% freq(`A1 - I am satisfied with the appearance of the format *`)
kruskal.test(`A1 - I am satisfied with the appearance of the format *` ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, `A1 - I am satisfied with the appearance of the format *` ~ Condición)

db_pobl_completo %>% group_by(Condición) %>% freq(`A2 - I would understand better the information with more numeric data`)
kruskal.test(`A2 - I would understand better the information with more numeric data` ~ Condición, data = db_pobl_completo)

db_pobl_completo %>% group_by(Condición) %>% freq(`A3 – I would understand better the information with more explications`)
kruskal.test(`A3 – I would understand better the information with more explications` ~ Condición, data = db_pobl_completo)

db_pobl_completo %>% group_by(Condición) %>% freq(`A4 – I think that the format is appropriate for this type of information *`)
kruskal.test(`A4 – I think that the format is appropriate for this type of information *` ~ Condición, data = db_pobl_completo)
dunn_test(data = db_pobl_completo, `A4 – I think that the format is appropriate for this type of information *` ~ Condición)

db_pobl_completo %>% group_by(Condición) %>% freq(`A5 – It was easy to remember the information to answer the questions`)
kruskal.test(`A5 – It was easy to remember the information to answer the questions` ~ Condición, data = db_pobl_completo)

db_pobl_completo %>% group_by(Condición) %>% freq(`A6 – I think that the information is understandable for someone with no knowledge of this topic`)
kruskal.test(`A6 – I think that the information is understandable for someone with no knowledge of this topic` ~ Condición, data = db_pobl_completo)

db_pobl_completo %>% group_by(Condición) %>% freq(`A7 – I think that I could explain to somebody the presented information`)
kruskal.test(`A7 – I think that I could explain to somebody the presented information` ~ Condición, data = db_pobl_completo)

db_pobl_completo %>% group_by(Condición) %>% freq(`A8 – It is not possible to understand the topic with so little information`)
kruskal.test(`A8 – It is not possible to understand the topic with so little information` ~ Condición, data = db_pobl_completo)

##S2B. Participant-reported satisfaction and acceptability. Specialized population----------------
db_prof_completo %>% group_by(Condición) %>% freq(`B1 - I am satisfied with the appearance of the format`)
kruskal.test(`B1 - I am satisfied with the appearance of the format` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B2 - I would understand better the information with more numeric data`)
kruskal.test(`B2 - I would understand better the information with more numeric data` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B3 – I would understand better the information with more explications`)
kruskal.test(`B3 – I would understand better the information with more explications` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B4 – I think that less data/explications would be enough to understand the conclusions of the study`)
kruskal.test(`B4 – I think that less data/explications would be enough to understand the conclusions of the study` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B5 – I think that the format is appropriate for this type of information *`)
kruskal.test(`B5 – I think that the format is appropriate for this type of information *` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B6 – It was easy to remember the information to answer the questions *`)
kruskal.test(`B6 – It was easy to remember the information to answer the questions *` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B7 – I think that the information is understandable for someone with no knowledge of economic evaluations *`)
kruskal.test(`B7 – I think that the information is understandable for someone with no knowledge of economic evaluations *` ~ Condición, data = db_prof_completo)

db_prof_completo %>% group_by(Condición) %>% freq(`B8 – I think that this information is sufficient for decision making`)
kruskal.test(`B8 – I think that this information is sufficient for decision making` ~ Condición, data = db_prof_completo)




