# DEBUG
# targets::tar_load(input_files)
# params = list(
#   input_files_vector = input_files,
#   pid_report = 999,
#   last_task = "Goodbye",
#   goal = 500
# )

knitr::opts_chunk$set(echo = TRUE)

Protocol r params$pid_report {.tabset}

DF = show_progress_pid(pid = params$pid_report, 
                       files_vector = params$input_files_vector, 
                       last_task = params$last_task, 
                       goal = params$goal)

number_participants = DF$DF_progress$suma_total %>%  first()
DIFF_days = DF$DF_progress$days_since_start %>% first()
rate_per_day = DF$DF_progress$rate %>% first()

r number_participants participants completed the protocol in r DIFF_days days (~r rate_per_day per day).


Summary table

DT::datatable(DF$TABLE,
              width = "50%",
              rownames = FALSE,
              options = list(dom = 't',
                             pageLength = 50,
                             lengthMenu = c(50, 100, 1000)))

Full table

DT::datatable(DF$DF_progress,
              width = "50%",
              rownames = FALSE,
              options = list(dom = 't',
                             pageLength = 50,
                             lengthMenu = c(50, 100, 1000)))

Plot

DF$PLOT_progress

filename_plot = here::here(paste0("outputs/plots/plot_", 
                                  gsub("\\/", "_", params$pid_report), # So it works in dev protocols
                                  "_progress.png"))

ggplot2::ggsave(filename_plot, DF$PLOT_progress, width = 16, height = 10, bg = "white")

All tasks

DT::datatable(DF$DF_files |> 
                distinct(id, experiment) |>  
                dplyr::count(experiment) |> 
                dplyr::arrange(dplyr::desc(n)),
              width = "50%",
              rownames = FALSE,
              options = list(dom = 't',
                             pageLength = 50,
                             lengthMenu = c(50, 100, 1000)))


gorkang/jsPsychHelpeR documentation built on Oct. 15, 2024, 8 a.m.