shiny::tags$h2(shiny::markdown("Careful with sensitive data")),
shiny::tags$p("The",shiny::tags$i(shiny::tags$b("FreesearchR")),"app only stores data for analyses, but please only use with sensitive data when running locally.","",shiny::tags$a("Read more here",href="https://agdamsbo.github.io/FreesearchR/#run-locally-on-your-own-machine"),"."),
dismissible=TRUE
),
m_redcap_readUI(
id="redcap_import",
title=""
)
),
shiny::conditionalPanel(
condition="input.source=='env'",
import_globalenv_ui(id="env",title=NULL)
),
# shiny::conditionalPanel(
# condition = "input.source=='redcap'",
# DT::DTOutput(outputId = "redcap_prev")
# ),
shiny::conditionalPanel(
condition="output.data_loaded == true",
shiny::br(),
shiny::actionButton(
inputId="modal_initial_view",
label="Quick overview",
width="100%",
icon=shiny::icon("binoculars"),
disabled=FALSE
),
shiny::br(),
shiny::br(),
shiny::h5("Select variables for final import"),
shiny::fluidRow(
shiny::column(
width=6,
shiny::p("Exclude incomplete variables:"),
shiny::br(),
shinyWidgets::noUiSliderInput(
inputId="complete_cutoff",
label=NULL,
update_on="end",
min=0,
max=100,
step=5,
value=30,
format=shinyWidgets::wNumbFormat(decimals=0),
color=datamods:::get_primary_color()
),
shiny::helpText("Only include variables missing less observations than the specified percentage."),
shiny::markdown("Below, are several options for simple data manipulation like update variables by renaming, creating new labels (for nicer tables in the report) and changing variable classes (numeric, factor/categorical etc.)."),
shiny::markdown("There are more advanced options to modify factor/categorical variables as well as create new factor from a continous variable or new variables with *R* code. At the bottom you can restore the original data."),
shiny::markdown("Please note that data modifications are applied before any filtering.")
)
)
),
update_variables_ui("modal_variables"),
shiny::tags$br(),
shiny::tags$br(),
shiny::tags$h4("Advanced data manipulation"),
shiny::tags$p("Below options allow more advanced varaible manipulations."),
shiny::tags$br(),
shiny::tags$br(),
shiny::fluidRow(
shiny::column(
width=4,
shiny::actionButton(
inputId="modal_update",
label="Reorder factor levels",
width="100%"
),
shiny::tags$br(),
shiny::helpText("Reorder the levels of factor/categorical variables."),
shiny::tags$br(),
shiny::tags$br()
),
shiny::column(
width=4,
shiny::actionButton(
inputId="modal_cut",
label="New factor",
width="100%"
),
shiny::tags$br(),
shiny::helpText("Create factor/categorical variable from a continous variable (number/date/time)."),
shiny::tags$br(),
shiny::tags$br()
),
shiny::column(
width=4,
shiny::actionButton(
inputId="modal_column",
label="New variable",
width="100%"
),
shiny::tags$br(),
shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")),
shiny::tags$br(),
shiny::tags$br()
)
),
tags$h4("Compare modified data to original"),
shiny::tags$br(),
shiny::tags$p(
"Raw print of the original vs the modified data."
),
shiny::tags$br(),
shiny::fluidRow(
shiny::column(
width=6,
shiny::tags$b("Original data:"),
shiny::verbatimTextOutput("original_str")
),
shiny::column(
width=6,
shiny::tags$b("Modified data:"),
shiny::verbatimTextOutput("modified_str")
)
),
shiny::tags$br(),
shiny::actionButton(
inputId="data_reset",
label="Restore original data",
width="100%"
),
shiny::tags$br(),
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing."),
shiny::helpText("Only factor/categorical variables are available for stratification. Go back to the 'Prepare' tab to reclass a variable if it's not on the list."),
shiny::conditionalPanel(
condition="input.strat_var!='none'",
shiny::radioButtons(
inputId="add_p",
label="Compare strata?",
selected="no",
inline=TRUE,
choices=list(
"No"="no",
"Yes"="yes"
)
),
shiny::helpText("Option to perform statistical comparisons between strata in baseline table.")
shiny::helpText("To consider if data is missing by random, choose the outcome/dependent variable, if it has any missings to evaluate if there is a significant difference across other variables depending on missing data or not.")
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
shiny::br(),
shiny::br(),
shiny::selectInput(
inputId="output_type",
label="Output format",
selected=NULL,
choices=list(
"MS Word"="docx",
"LibreOffice"="odt"
# ,
# "PDF" = "pdf",
# "All the above" = "all"
)
),
shiny::br(),
# Button
shiny::downloadButton(
outputId="report",
label="Download report",
icon=shiny::icon("download")
)
# shiny::helpText("If choosing to output to MS Word, please note, that when opening the document, two errors will pop-up. Choose to repair and choose not to update references. The issue is being worked on. You can always choose LibreOffice instead."),
),
shiny::column(
width=6,
shiny::h4("Data"),
shiny::helpText("Choose your favourite output data format to download the modified data."),
shiny::br(),
shiny::br(),
shiny::selectInput(
inputId="data_type",
label="Data format",
selected=NULL,
choices=list(
"R"="rds",
"stata"="dta",
"CSV"="csv"
)
),
shiny::helpText("No metadata is saved when exporting to csv."),
shiny::br(),
shiny::br(),
# Button
shiny::downloadButton(
outputId="data_modified",
label="Download data",
icon=shiny::icon("download")
)
)
),
shiny::br(),
shiny::br(),
shiny::h4("Code snippets"),
shiny::tags$p("Below are the code bits used to create the final data set and the main analyses."),
shiny::tags$p("This can be used as a starting point for learning to code and for reproducibility."),