mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 09:59:39 +02:00
reordered data panel
This commit is contained in:
parent
14edce9912
commit
3dea828d20
6 changed files with 586 additions and 582 deletions
|
@ -1 +1 @@
|
||||||
app_version <- function()'250225_0948'
|
app_version <- function()'250226_1216'
|
||||||
|
|
|
@ -155,6 +155,7 @@ overview_vars <- function(data) {
|
||||||
|
|
||||||
dplyr::tibble(
|
dplyr::tibble(
|
||||||
class = get_classes(data),
|
class = get_classes(data),
|
||||||
|
type = get_classes(data),
|
||||||
name = names(data),
|
name = names(data),
|
||||||
n_missing = unname(colSums(is.na(data))),
|
n_missing = unname(colSums(is.na(data))),
|
||||||
p_complete = 1 - n_missing / nrow(data),
|
p_complete = 1 - n_missing / nrow(data),
|
||||||
|
@ -187,10 +188,11 @@ create_overview_datagrid <- function(data) {
|
||||||
std_names <- c(
|
std_names <- c(
|
||||||
"Name" = "name",
|
"Name" = "name",
|
||||||
"Class" = "class",
|
"Class" = "class",
|
||||||
"Missing" = "n_missing",
|
"Type" = "type",
|
||||||
|
"Missings" = "n_missing",
|
||||||
"Complete" = "p_complete",
|
"Complete" = "p_complete",
|
||||||
"Unique" = "n_unique",
|
"Unique" = "n_unique",
|
||||||
"Plot" = "vals"
|
"Distribution" = "vals"
|
||||||
)
|
)
|
||||||
|
|
||||||
headers <- lapply(col.names, \(.x){
|
headers <- lapply(col.names, \(.x){
|
||||||
|
@ -204,15 +206,28 @@ create_overview_datagrid <- function(data) {
|
||||||
grid <- toastui::datagrid(
|
grid <- toastui::datagrid(
|
||||||
data = data,
|
data = data,
|
||||||
theme = "default",
|
theme = "default",
|
||||||
colwidths = "auto"
|
colwidths = "fit"
|
||||||
)
|
)
|
||||||
|
|
||||||
grid <- toastui::grid_columns(
|
grid <- toastui::grid_columns(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
columns = col.names,
|
columns = col.names,
|
||||||
header = headers,
|
header = headers,
|
||||||
resizable = TRUE,
|
resizable = TRUE
|
||||||
width = 80
|
)
|
||||||
|
|
||||||
|
grid <- toastui::grid_columns(
|
||||||
|
grid = grid,
|
||||||
|
columns = "vals",
|
||||||
|
width = 120
|
||||||
|
)
|
||||||
|
|
||||||
|
grid <- toastui::grid_columns(
|
||||||
|
grid = grid,
|
||||||
|
columns = "class",
|
||||||
|
header = " ",
|
||||||
|
align = "center",sortable = FALSE,
|
||||||
|
width = 40
|
||||||
)
|
)
|
||||||
|
|
||||||
grid <- add_class_icon(
|
grid <- add_class_icon(
|
||||||
|
|
|
@ -69,10 +69,11 @@ update_variables_ui <- function(id, title = TRUE) {
|
||||||
id = ns("update-result"),
|
id = ns("update-result"),
|
||||||
status = "info",
|
status = "info",
|
||||||
phosphoricons::ph("info"),
|
phosphoricons::ph("info"),
|
||||||
datamods::i18n(paste(
|
paste(
|
||||||
"Select, rename and convert variables in table above,",
|
"Select variables to keep (if none selected, all are kept), rename",
|
||||||
"then apply changes by clicking button below."
|
"variables and labels, and convert variable type/class in the table",
|
||||||
))
|
"above. Apply changes by clicking the button below."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
|
@ -281,7 +282,24 @@ update_variables_server <- function(id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
modal_update_variables <- function(id,
|
||||||
|
title = "Select, rename and reclass variables",
|
||||||
|
easyClose = TRUE,
|
||||||
|
size = "xl",
|
||||||
|
footer = NULL) {
|
||||||
|
ns <- NS(id)
|
||||||
|
showModal(modalDialog(
|
||||||
|
title = tagList(title, datamods:::button_close_modal()),
|
||||||
|
update_variables_ui(id),
|
||||||
|
tags$div(
|
||||||
|
style = "display: none;",
|
||||||
|
textInput(inputId = ns("hidden"), label = NULL, value = datamods:::genId())
|
||||||
|
),
|
||||||
|
easyClose = easyClose,
|
||||||
|
size = size,
|
||||||
|
footer = footer
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -516,7 +534,7 @@ update_variables_datagrid <- function(data, height = NULL, selectionId = NULL, b
|
||||||
grid = grid,
|
grid = grid,
|
||||||
column = "class_toset",
|
column = "class_toset",
|
||||||
type = "select",
|
type = "select",
|
||||||
choices = c("Select new class", "character", "factor", "numeric", "integer", "date", "datetime", "hms")
|
choices = c("Select", "character", "factor", "numeric", "integer", "date", "datetime", "hms")
|
||||||
)
|
)
|
||||||
grid <- toastui::grid_editor_opts(
|
grid <- toastui::grid_editor_opts(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#### Current file: R//app_version.R
|
#### Current file: R//app_version.R
|
||||||
########
|
########
|
||||||
|
|
||||||
app_version <- function()'250225_0948'
|
app_version <- function()'250226_1216'
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
|
@ -1756,6 +1756,7 @@ overview_vars <- function(data) {
|
||||||
|
|
||||||
dplyr::tibble(
|
dplyr::tibble(
|
||||||
class = get_classes(data),
|
class = get_classes(data),
|
||||||
|
type = get_classes(data),
|
||||||
name = names(data),
|
name = names(data),
|
||||||
n_missing = unname(colSums(is.na(data))),
|
n_missing = unname(colSums(is.na(data))),
|
||||||
p_complete = 1 - n_missing / nrow(data),
|
p_complete = 1 - n_missing / nrow(data),
|
||||||
|
@ -1788,10 +1789,11 @@ create_overview_datagrid <- function(data) {
|
||||||
std_names <- c(
|
std_names <- c(
|
||||||
"Name" = "name",
|
"Name" = "name",
|
||||||
"Class" = "class",
|
"Class" = "class",
|
||||||
"Missing" = "n_missing",
|
"Type" = "type",
|
||||||
|
"Missings" = "n_missing",
|
||||||
"Complete" = "p_complete",
|
"Complete" = "p_complete",
|
||||||
"Unique" = "n_unique",
|
"Unique" = "n_unique",
|
||||||
"Plot" = "vals"
|
"Distribution" = "vals"
|
||||||
)
|
)
|
||||||
|
|
||||||
headers <- lapply(col.names, \(.x){
|
headers <- lapply(col.names, \(.x){
|
||||||
|
@ -1805,15 +1807,28 @@ create_overview_datagrid <- function(data) {
|
||||||
grid <- toastui::datagrid(
|
grid <- toastui::datagrid(
|
||||||
data = data,
|
data = data,
|
||||||
theme = "default",
|
theme = "default",
|
||||||
colwidths = "auto"
|
colwidths = "fit"
|
||||||
)
|
)
|
||||||
|
|
||||||
grid <- toastui::grid_columns(
|
grid <- toastui::grid_columns(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
columns = col.names,
|
columns = col.names,
|
||||||
header = headers,
|
header = headers,
|
||||||
resizable = TRUE,
|
resizable = TRUE
|
||||||
width = 80
|
)
|
||||||
|
|
||||||
|
grid <- toastui::grid_columns(
|
||||||
|
grid = grid,
|
||||||
|
columns = "vals",
|
||||||
|
width = 120
|
||||||
|
)
|
||||||
|
|
||||||
|
grid <- toastui::grid_columns(
|
||||||
|
grid = grid,
|
||||||
|
columns = "class",
|
||||||
|
header = " ",
|
||||||
|
align = "center",sortable = FALSE,
|
||||||
|
width = 40
|
||||||
)
|
)
|
||||||
|
|
||||||
grid <- add_class_icon(
|
grid <- add_class_icon(
|
||||||
|
@ -4190,10 +4205,11 @@ update_variables_ui <- function(id, title = TRUE) {
|
||||||
id = ns("update-result"),
|
id = ns("update-result"),
|
||||||
status = "info",
|
status = "info",
|
||||||
phosphoricons::ph("info"),
|
phosphoricons::ph("info"),
|
||||||
datamods::i18n(paste(
|
paste(
|
||||||
"Select, rename and convert variables in table above,",
|
"Select variables to keep (if none selected, all are kept), rename",
|
||||||
"then apply changes by clicking button below."
|
"variables and labels, and convert variable type/class in the table",
|
||||||
))
|
"above. Apply changes by clicking the button below."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
|
@ -4402,7 +4418,24 @@ update_variables_server <- function(id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
modal_update_variables <- function(id,
|
||||||
|
title = "Select, rename and reclass variables",
|
||||||
|
easyClose = TRUE,
|
||||||
|
size = "xl",
|
||||||
|
footer = NULL) {
|
||||||
|
ns <- NS(id)
|
||||||
|
showModal(modalDialog(
|
||||||
|
title = tagList(title, datamods:::button_close_modal()),
|
||||||
|
update_variables_ui(id),
|
||||||
|
tags$div(
|
||||||
|
style = "display: none;",
|
||||||
|
textInput(inputId = ns("hidden"), label = NULL, value = datamods:::genId())
|
||||||
|
),
|
||||||
|
easyClose = easyClose,
|
||||||
|
size = size,
|
||||||
|
footer = footer
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4637,7 +4670,7 @@ update_variables_datagrid <- function(data, height = NULL, selectionId = NULL, b
|
||||||
grid = grid,
|
grid = grid,
|
||||||
column = "class_toset",
|
column = "class_toset",
|
||||||
type = "select",
|
type = "select",
|
||||||
choices = c("Select new class", "character", "factor", "numeric", "integer", "date", "datetime", "hms")
|
choices = c("Select", "character", "factor", "numeric", "integer", "date", "datetime", "hms")
|
||||||
)
|
)
|
||||||
grid <- toastui::grid_editor_opts(
|
grid <- toastui::grid_editor_opts(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
|
@ -4914,68 +4947,66 @@ ui_elements <- list(
|
||||||
shiny::column(width = 2),
|
shiny::column(width = 2),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 8,
|
width = 8,
|
||||||
|
shiny::h4("Choose your data source"),
|
||||||
|
shiny::br(),
|
||||||
shiny::h4("Choose your data source"),
|
shinyWidgets::radioGroupButtons(
|
||||||
shiny::br(),
|
inputId = "source",
|
||||||
shinyWidgets::radioGroupButtons(
|
selected = "env",
|
||||||
inputId = "source",
|
choices = c(
|
||||||
selected = "env",
|
"File upload" = "file",
|
||||||
choices = c(
|
"REDCap server" = "redcap",
|
||||||
"File upload" = "file",
|
"Local data" = "env"
|
||||||
"REDCap server" = "redcap",
|
),
|
||||||
"Local data" = "env"
|
width = "100%"
|
||||||
),
|
),
|
||||||
width = "100%"
|
shiny::helpText("Upload a file from your device, get data directly from REDCap or select a sample data set for testing from the app."),
|
||||||
),
|
shiny::conditionalPanel(
|
||||||
shiny::helpText("Upload a file from your device, get data directly from REDCap or select a sample data set for testing from the app."),
|
condition = "input.source=='file'",
|
||||||
shiny::conditionalPanel(
|
datamods::import_file_ui("file_import",
|
||||||
condition = "input.source=='file'",
|
title = "Choose a datafile to upload",
|
||||||
datamods::import_file_ui("file_import",
|
file_extensions = c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst", ".sas7bdat", ".sav", ".ods", ".dta")
|
||||||
title = "Choose a datafile to upload",
|
)
|
||||||
file_extensions = c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst", ".sas7bdat", ".sav", ".ods", ".dta")
|
),
|
||||||
)
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='redcap'",
|
||||||
shiny::conditionalPanel(
|
m_redcap_readUI("redcap_import")
|
||||||
condition = "input.source=='redcap'",
|
),
|
||||||
m_redcap_readUI("redcap_import")
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='env'",
|
||||||
shiny::conditionalPanel(
|
import_globalenv_ui(id = "env", title = NULL)
|
||||||
condition = "input.source=='env'",
|
),
|
||||||
import_globalenv_ui(id = "env", title = NULL)
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='redcap'",
|
||||||
shiny::conditionalPanel(
|
DT::DTOutput(outputId = "redcap_prev")
|
||||||
condition = "input.source=='redcap'",
|
),
|
||||||
DT::DTOutput(outputId = "redcap_prev")
|
shiny::br(),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::h5("Exclude in-complete variables"),
|
||||||
shiny::br(),
|
shiny::p("Before going further, you can exclude variables with a low degree of completeness."),
|
||||||
shiny::h5("Exclude in-complete variables"),
|
shiny::br(),
|
||||||
shiny::p("Before going further, you can exclude variables with a low degree of completeness."),
|
shinyWidgets::noUiSliderInput(
|
||||||
shiny::br(),
|
inputId = "complete_cutoff",
|
||||||
shinyWidgets::noUiSliderInput(
|
label = "Choose completeness threshold (%)",
|
||||||
inputId = "complete_cutoff",
|
min = 0,
|
||||||
label = "Choose completeness threshold (%)",
|
max = 100,
|
||||||
min = 0,
|
step = 10,
|
||||||
max = 100,
|
value = 70,
|
||||||
step = 10,
|
format = shinyWidgets::wNumbFormat(decimals = 0),
|
||||||
value = 70,
|
color = datamods:::get_primary_color()
|
||||||
format = shinyWidgets::wNumbFormat(decimals = 0),
|
),
|
||||||
color = datamods:::get_primary_color()
|
shiny::helpText("Only include variables with completeness above a specified percentage."),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::helpText("Only include variables with completeness above a specified percentage."),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::actionButton(
|
||||||
shiny::br(),
|
inputId = "act_start",
|
||||||
shiny::actionButton(
|
label = "Start",
|
||||||
inputId = "act_start",
|
width = "100%",
|
||||||
label = "Start",
|
icon = shiny::icon("play")
|
||||||
width = "100%",
|
),
|
||||||
icon = shiny::icon("play")
|
shiny::helpText('After importing, hit "Start" or navigate to the desired tab.'),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::helpText('After importing, hit "Start" or navigate to the desired tab.'),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::column(width = 2)
|
||||||
shiny::br(),
|
|
||||||
shiny::column(width = 2)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -4991,6 +5022,47 @@ ui_elements <- list(
|
||||||
title = "Data",
|
title = "Data",
|
||||||
bslib::navset_bar(
|
bslib::navset_bar(
|
||||||
fillable = TRUE,
|
fillable = TRUE,
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Overview",
|
||||||
|
tags$h3("Overview and filtering"),
|
||||||
|
fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 9,
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below is a short summary table of the provided data.
|
||||||
|
On the right hand side you have the option to create filters.
|
||||||
|
At the bottom you'll find a raw overview of the original vs the modified data."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 9,
|
||||||
|
data_summary_ui(id = "data_summary")
|
||||||
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 3,
|
||||||
|
IDEAFilter::IDEAFilter_ui("data_filter"),
|
||||||
|
shiny::tags$br()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Browse",
|
||||||
|
tags$h3("Browse the provided data"),
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below is a table with all the modified data provided to browse and understand data."
|
||||||
|
),
|
||||||
|
shinyWidgets::html_dependency_winbox(),
|
||||||
|
fluidRow(
|
||||||
|
toastui::datagridOutput(outputId = "table_mod")
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br()
|
||||||
|
),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Modify",
|
title = "Modify",
|
||||||
tags$h3("Subset, rename and convert variables"),
|
tags$h3("Subset, rename and convert variables"),
|
||||||
|
@ -5004,112 +5076,80 @@ ui_elements <- list(
|
||||||
),
|
),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
update_variables_ui("vars_update"),
|
|
||||||
shiny::tags$br()
|
|
||||||
),
|
),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 3,
|
width = 8,
|
||||||
tags$h4("Create new variables"),
|
fluidRow(
|
||||||
shiny::tags$br(),
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
tags$h4("Update variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "modal_variables",
|
||||||
|
label = "Subset, rename and change class/type",
|
||||||
|
width = "100%"
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::helpText("Subset variables, rename variables and labels, and apply new class to variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
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 = 6,
|
||||||
|
tags$h4("Create new variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "modal_cut",
|
||||||
|
label = "Create factor variable",
|
||||||
|
width = "100%"
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::helpText("Create factor/categorical variable from an other value."),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
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("Restore"),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "modal_cut",
|
inputId = "data_reset",
|
||||||
label = "Create factor variable",
|
label = "Restore original data",
|
||||||
width = "100%"
|
width = "100%"
|
||||||
),
|
),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText("Create factor/categorical variable from an other value."),
|
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
||||||
shiny::tags$br(),
|
),
|
||||||
shiny::tags$br(),
|
|
||||||
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::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() # ,
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# IDEAFilter::IDEAFilter_ui("data_filter") # ,
|
|
||||||
# shiny::actionButton("save_filter", "Apply the filter")
|
|
||||||
)
|
|
||||||
# datamods::update_variables_ui("vars_update")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Filter",
|
|
||||||
tags$h3("Data filtering"),
|
|
||||||
fluidRow(
|
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
shiny::tags$p(
|
|
||||||
"Below is a short summary table of the provided data.
|
|
||||||
On the right hand side you have the option to create filters.
|
|
||||||
At the bottom you'll find a raw overview of the original vs the modified data."
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
fluidRow(
|
shiny::tags$br(),
|
||||||
# column(
|
shiny::tags$br(),
|
||||||
# width = 3,
|
tags$h4("Restore"),
|
||||||
# shiny::uiOutput("filter_vars"),
|
shiny::tags$br(),
|
||||||
# shiny::conditionalPanel(
|
shiny::tags$p(
|
||||||
# condition = "(typeof input.filter_vars !== 'undefined' && input.filter_vars.length > 0)",
|
"Below, you'll find a raw overview of the original vs the modified data."
|
||||||
# datamods::filter_data_ui("filtering", max_height = "500px")
|
|
||||||
# )
|
|
||||||
# ),
|
|
||||||
# column(
|
|
||||||
# width = 9,
|
|
||||||
# DT::DTOutput(outputId = "filtered_table"),
|
|
||||||
# tags$b("Code dplyr:"),
|
|
||||||
# verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
shiny::column(
|
|
||||||
width = 9,
|
|
||||||
data_summary_ui(id = "data_summary")
|
|
||||||
),
|
|
||||||
shiny::column(
|
|
||||||
width = 3,
|
|
||||||
IDEAFilter::IDEAFilter_ui("data_filter"),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$b("Filter code:"),
|
|
||||||
# shiny::verbatimTextOutput(outputId = "filtered_code"),
|
|
||||||
shiny::tags$br()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Restore",
|
|
||||||
tags$h3("Compare to original and restore"),
|
|
||||||
fluidRow(
|
|
||||||
shiny::column(
|
|
||||||
width = 9,
|
|
||||||
shiny::tags$p(
|
|
||||||
"Right below, you have the option to restore to the originally imported data.
|
|
||||||
At the bottom you'll find a raw overview of the original vs the modified data."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
shiny::tags$br(),
|
|
||||||
tags$h4("Restore"),
|
|
||||||
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::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
column(
|
column(
|
||||||
width = 6,
|
width = 6,
|
||||||
|
@ -5124,64 +5164,7 @@ ui_elements <- list(
|
||||||
verbatimTextOutput("modified_str")
|
verbatimTextOutput("modified_str")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Browse",
|
|
||||||
tags$h3("Browse the provided data"),
|
|
||||||
shiny::tags$p(
|
|
||||||
"Below is a table with all the modified data provided to browse and understand data."
|
|
||||||
),
|
|
||||||
shinyWidgets::html_dependency_winbox(),
|
|
||||||
# fluidRow(
|
|
||||||
# column(
|
|
||||||
# width = 3,
|
|
||||||
# shiny::uiOutput("filter_vars"),
|
|
||||||
# shiny::conditionalPanel(
|
|
||||||
# condition = "(typeof input.filter_vars !== 'undefined' && input.filter_vars.length > 0)",
|
|
||||||
# datamods::filter_data_ui("filtering", max_height = "500px")
|
|
||||||
# )
|
|
||||||
# ),
|
|
||||||
# column(
|
|
||||||
# width = 9,
|
|
||||||
# DT::DTOutput(outputId = "filtered_table"),
|
|
||||||
# tags$b("Code dplyr:"),
|
|
||||||
# verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
# shiny::column(
|
|
||||||
# width = 8,
|
|
||||||
fluidRow(
|
|
||||||
toastui::datagridOutput(outputId = "table_mod")
|
|
||||||
),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br()
|
|
||||||
# ,
|
|
||||||
# shiny::tags$b("Reproducible code:"),
|
|
||||||
# shiny::verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
# shiny::column(
|
|
||||||
# width = 4,
|
|
||||||
# shiny::actionButton("modal_cut", "Create factor from a variable"),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::actionButton("modal_update", "Reorder factor levels")#,
|
|
||||||
# # shiny::tags$br(),
|
|
||||||
# # shiny::tags$br(),
|
|
||||||
# # IDEAFilter::IDEAFilter_ui("data_filter") # ,
|
|
||||||
# # shiny::actionButton("save_filter", "Apply the filter")
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# column(
|
|
||||||
# 8,
|
|
||||||
# shiny::verbatimTextOutput("filtered_code"),
|
|
||||||
# DT::DTOutput("filtered_table")
|
|
||||||
# ),
|
|
||||||
# column(4, IDEAFilter::IDEAFilter_ui("data_filter"))
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
@ -5195,8 +5178,6 @@ ui_elements <- list(
|
||||||
id = "navdescribe",
|
id = "navdescribe",
|
||||||
bslib::navset_bar(
|
bslib::navset_bar(
|
||||||
title = "",
|
title = "",
|
||||||
# bslib::layout_sidebar(
|
|
||||||
# fillable = TRUE,
|
|
||||||
sidebar = bslib::sidebar(
|
sidebar = bslib::sidebar(
|
||||||
bslib::accordion(
|
bslib::accordion(
|
||||||
open = "acc_chars",
|
open = "acc_chars",
|
||||||
|
@ -5407,70 +5388,70 @@ ui_elements <- list(
|
||||||
shiny::column(width = 2),
|
shiny::column(width = 2),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 8,
|
width = 8,
|
||||||
shiny::fluidRow(
|
shiny::fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 6,
|
width = 6,
|
||||||
shiny::h4("Report"),
|
shiny::h4("Report"),
|
||||||
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::selectInput(
|
shiny::selectInput(
|
||||||
inputId = "output_type",
|
inputId = "output_type",
|
||||||
label = "Output format",
|
label = "Output format",
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
choices = list(
|
choices = list(
|
||||||
"MS Word" = "docx",
|
"MS Word" = "docx",
|
||||||
"LibreOffice" = "odt"
|
"LibreOffice" = "odt"
|
||||||
# ,
|
# ,
|
||||||
# "PDF" = "pdf",
|
# "PDF" = "pdf",
|
||||||
# "All the above" = "all"
|
# "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(),
|
||||||
# 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::tags$b("Code snippets:"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_import"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_data"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_filter"),
|
||||||
|
shiny::tags$br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::selectInput(
|
shiny::column(width = 2)
|
||||||
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::tags$b("Code snippets:"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_import"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_data"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_filter"),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::br(),
|
|
||||||
shiny::column(width = 2)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -5745,11 +5726,11 @@ server <- function(input, output, session) {
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
eventExpr = list(
|
eventExpr = list(
|
||||||
rv$data_original,
|
rv$data_original,
|
||||||
input$reset_confirm,
|
|
||||||
input$complete_cutoff
|
input$complete_cutoff
|
||||||
),
|
),
|
||||||
handlerExpr = {
|
handlerExpr = {
|
||||||
shiny::req(rv$data_original)
|
shiny::req(rv$data_original)
|
||||||
|
|
||||||
rv$data <- rv$data_original |>
|
rv$data <- rv$data_original |>
|
||||||
# janitor::clean_names() |>
|
# janitor::clean_names() |>
|
||||||
default_parsing() |>
|
default_parsing() |>
|
||||||
|
@ -5759,10 +5740,25 @@ server <- function(input, output, session) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## For now this solution work, but I would prefer to solve this with the above
|
||||||
|
shiny::observeEvent(input$reset_confirm, {
|
||||||
|
if (isTRUE(input$reset_confirm)) {
|
||||||
|
shiny::req(rv$data_original)
|
||||||
|
rv$data <- rv$data_original |>
|
||||||
|
default_parsing() |>
|
||||||
|
remove_empty_cols(
|
||||||
|
cutoff = input$complete_cutoff / 100
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}, ignoreNULL = TRUE)
|
||||||
|
|
||||||
|
|
||||||
shiny::observeEvent(input$data_reset, {
|
shiny::observeEvent(input$data_reset, {
|
||||||
shinyWidgets::ask_confirmation(
|
shinyWidgets::ask_confirmation(
|
||||||
|
cancelOnDismiss = TRUE,
|
||||||
inputId = "reset_confirm",
|
inputId = "reset_confirm",
|
||||||
title = "Please confirm data reset?"
|
title = "Please confirm data reset?",
|
||||||
|
type = "warning"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5790,6 +5786,12 @@ server <- function(input, output, session) {
|
||||||
## Further modifications are needed to have cut/bin options based on class of variable
|
## Further modifications are needed to have cut/bin options based on class of variable
|
||||||
## Could be defined server-side
|
## Could be defined server-side
|
||||||
|
|
||||||
|
shiny::observeEvent(
|
||||||
|
input$modal_variables,
|
||||||
|
modal_update_variables("modal_variables",title = "Modify factor levels")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
######### Create factor
|
######### Create factor
|
||||||
|
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
|
@ -5868,7 +5870,7 @@ server <- function(input, output, session) {
|
||||||
|
|
||||||
# updated_data <- datamods::update_variables_server(
|
# updated_data <- datamods::update_variables_server(
|
||||||
updated_data <- update_variables_server(
|
updated_data <- update_variables_server(
|
||||||
id = "vars_update",
|
id = "modal_variables",
|
||||||
data = reactive(rv$data),
|
data = reactive(rv$data),
|
||||||
return_data_on_init = FALSE
|
return_data_on_init = FALSE
|
||||||
)
|
)
|
||||||
|
|
|
@ -194,11 +194,11 @@ server <- function(input, output, session) {
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
eventExpr = list(
|
eventExpr = list(
|
||||||
rv$data_original,
|
rv$data_original,
|
||||||
input$reset_confirm,
|
|
||||||
input$complete_cutoff
|
input$complete_cutoff
|
||||||
),
|
),
|
||||||
handlerExpr = {
|
handlerExpr = {
|
||||||
shiny::req(rv$data_original)
|
shiny::req(rv$data_original)
|
||||||
|
|
||||||
rv$data <- rv$data_original |>
|
rv$data <- rv$data_original |>
|
||||||
# janitor::clean_names() |>
|
# janitor::clean_names() |>
|
||||||
default_parsing() |>
|
default_parsing() |>
|
||||||
|
@ -208,10 +208,25 @@ server <- function(input, output, session) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## For now this solution work, but I would prefer to solve this with the above
|
||||||
|
shiny::observeEvent(input$reset_confirm, {
|
||||||
|
if (isTRUE(input$reset_confirm)) {
|
||||||
|
shiny::req(rv$data_original)
|
||||||
|
rv$data <- rv$data_original |>
|
||||||
|
default_parsing() |>
|
||||||
|
remove_empty_cols(
|
||||||
|
cutoff = input$complete_cutoff / 100
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}, ignoreNULL = TRUE)
|
||||||
|
|
||||||
|
|
||||||
shiny::observeEvent(input$data_reset, {
|
shiny::observeEvent(input$data_reset, {
|
||||||
shinyWidgets::ask_confirmation(
|
shinyWidgets::ask_confirmation(
|
||||||
|
cancelOnDismiss = TRUE,
|
||||||
inputId = "reset_confirm",
|
inputId = "reset_confirm",
|
||||||
title = "Please confirm data reset?"
|
title = "Please confirm data reset?",
|
||||||
|
type = "warning"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -239,6 +254,12 @@ server <- function(input, output, session) {
|
||||||
## Further modifications are needed to have cut/bin options based on class of variable
|
## Further modifications are needed to have cut/bin options based on class of variable
|
||||||
## Could be defined server-side
|
## Could be defined server-side
|
||||||
|
|
||||||
|
shiny::observeEvent(
|
||||||
|
input$modal_variables,
|
||||||
|
modal_update_variables("modal_variables",title = "Modify factor levels")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
######### Create factor
|
######### Create factor
|
||||||
|
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
|
@ -317,7 +338,7 @@ server <- function(input, output, session) {
|
||||||
|
|
||||||
# updated_data <- datamods::update_variables_server(
|
# updated_data <- datamods::update_variables_server(
|
||||||
updated_data <- update_variables_server(
|
updated_data <- update_variables_server(
|
||||||
id = "vars_update",
|
id = "modal_variables",
|
||||||
data = reactive(rv$data),
|
data = reactive(rv$data),
|
||||||
return_data_on_init = FALSE
|
return_data_on_init = FALSE
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,68 +29,66 @@ ui_elements <- list(
|
||||||
shiny::column(width = 2),
|
shiny::column(width = 2),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 8,
|
width = 8,
|
||||||
|
shiny::h4("Choose your data source"),
|
||||||
|
shiny::br(),
|
||||||
shiny::h4("Choose your data source"),
|
shinyWidgets::radioGroupButtons(
|
||||||
shiny::br(),
|
inputId = "source",
|
||||||
shinyWidgets::radioGroupButtons(
|
selected = "env",
|
||||||
inputId = "source",
|
choices = c(
|
||||||
selected = "env",
|
"File upload" = "file",
|
||||||
choices = c(
|
"REDCap server" = "redcap",
|
||||||
"File upload" = "file",
|
"Local data" = "env"
|
||||||
"REDCap server" = "redcap",
|
),
|
||||||
"Local data" = "env"
|
width = "100%"
|
||||||
),
|
),
|
||||||
width = "100%"
|
shiny::helpText("Upload a file from your device, get data directly from REDCap or select a sample data set for testing from the app."),
|
||||||
),
|
shiny::conditionalPanel(
|
||||||
shiny::helpText("Upload a file from your device, get data directly from REDCap or select a sample data set for testing from the app."),
|
condition = "input.source=='file'",
|
||||||
shiny::conditionalPanel(
|
datamods::import_file_ui("file_import",
|
||||||
condition = "input.source=='file'",
|
title = "Choose a datafile to upload",
|
||||||
datamods::import_file_ui("file_import",
|
file_extensions = c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst", ".sas7bdat", ".sav", ".ods", ".dta")
|
||||||
title = "Choose a datafile to upload",
|
)
|
||||||
file_extensions = c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst", ".sas7bdat", ".sav", ".ods", ".dta")
|
),
|
||||||
)
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='redcap'",
|
||||||
shiny::conditionalPanel(
|
m_redcap_readUI("redcap_import")
|
||||||
condition = "input.source=='redcap'",
|
),
|
||||||
m_redcap_readUI("redcap_import")
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='env'",
|
||||||
shiny::conditionalPanel(
|
import_globalenv_ui(id = "env", title = NULL)
|
||||||
condition = "input.source=='env'",
|
),
|
||||||
import_globalenv_ui(id = "env", title = NULL)
|
shiny::conditionalPanel(
|
||||||
),
|
condition = "input.source=='redcap'",
|
||||||
shiny::conditionalPanel(
|
DT::DTOutput(outputId = "redcap_prev")
|
||||||
condition = "input.source=='redcap'",
|
),
|
||||||
DT::DTOutput(outputId = "redcap_prev")
|
shiny::br(),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::h5("Exclude in-complete variables"),
|
||||||
shiny::br(),
|
shiny::p("Before going further, you can exclude variables with a low degree of completeness."),
|
||||||
shiny::h5("Exclude in-complete variables"),
|
shiny::br(),
|
||||||
shiny::p("Before going further, you can exclude variables with a low degree of completeness."),
|
shinyWidgets::noUiSliderInput(
|
||||||
shiny::br(),
|
inputId = "complete_cutoff",
|
||||||
shinyWidgets::noUiSliderInput(
|
label = "Choose completeness threshold (%)",
|
||||||
inputId = "complete_cutoff",
|
min = 0,
|
||||||
label = "Choose completeness threshold (%)",
|
max = 100,
|
||||||
min = 0,
|
step = 10,
|
||||||
max = 100,
|
value = 70,
|
||||||
step = 10,
|
format = shinyWidgets::wNumbFormat(decimals = 0),
|
||||||
value = 70,
|
color = datamods:::get_primary_color()
|
||||||
format = shinyWidgets::wNumbFormat(decimals = 0),
|
),
|
||||||
color = datamods:::get_primary_color()
|
shiny::helpText("Only include variables with completeness above a specified percentage."),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::helpText("Only include variables with completeness above a specified percentage."),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::actionButton(
|
||||||
shiny::br(),
|
inputId = "act_start",
|
||||||
shiny::actionButton(
|
label = "Start",
|
||||||
inputId = "act_start",
|
width = "100%",
|
||||||
label = "Start",
|
icon = shiny::icon("play")
|
||||||
width = "100%",
|
),
|
||||||
icon = shiny::icon("play")
|
shiny::helpText('After importing, hit "Start" or navigate to the desired tab.'),
|
||||||
),
|
shiny::br(),
|
||||||
shiny::helpText('After importing, hit "Start" or navigate to the desired tab.'),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::column(width = 2)
|
||||||
shiny::br(),
|
|
||||||
shiny::column(width = 2)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -106,6 +104,47 @@ ui_elements <- list(
|
||||||
title = "Data",
|
title = "Data",
|
||||||
bslib::navset_bar(
|
bslib::navset_bar(
|
||||||
fillable = TRUE,
|
fillable = TRUE,
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Overview",
|
||||||
|
tags$h3("Overview and filtering"),
|
||||||
|
fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 9,
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below is a short summary table of the provided data.
|
||||||
|
On the right hand side you have the option to create filters.
|
||||||
|
At the bottom you'll find a raw overview of the original vs the modified data."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 9,
|
||||||
|
data_summary_ui(id = "data_summary")
|
||||||
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 3,
|
||||||
|
IDEAFilter::IDEAFilter_ui("data_filter"),
|
||||||
|
shiny::tags$br()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Browse",
|
||||||
|
tags$h3("Browse the provided data"),
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below is a table with all the modified data provided to browse and understand data."
|
||||||
|
),
|
||||||
|
shinyWidgets::html_dependency_winbox(),
|
||||||
|
fluidRow(
|
||||||
|
toastui::datagridOutput(outputId = "table_mod")
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br()
|
||||||
|
),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Modify",
|
title = "Modify",
|
||||||
tags$h3("Subset, rename and convert variables"),
|
tags$h3("Subset, rename and convert variables"),
|
||||||
|
@ -119,112 +158,80 @@ ui_elements <- list(
|
||||||
),
|
),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
update_variables_ui("vars_update"),
|
|
||||||
shiny::tags$br()
|
|
||||||
),
|
),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 3,
|
width = 8,
|
||||||
tags$h4("Create new variables"),
|
fluidRow(
|
||||||
shiny::tags$br(),
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
tags$h4("Update variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "modal_variables",
|
||||||
|
label = "Subset, rename and change class/type",
|
||||||
|
width = "100%"
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::helpText("Subset variables, rename variables and labels, and apply new class to variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
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 = 6,
|
||||||
|
tags$h4("Create new variables"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "modal_cut",
|
||||||
|
label = "Create factor variable",
|
||||||
|
width = "100%"
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::helpText("Create factor/categorical variable from an other value."),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
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("Restore"),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "modal_cut",
|
inputId = "data_reset",
|
||||||
label = "Create factor variable",
|
label = "Restore original data",
|
||||||
width = "100%"
|
width = "100%"
|
||||||
),
|
),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText("Create factor/categorical variable from an other value."),
|
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
||||||
shiny::tags$br(),
|
),
|
||||||
shiny::tags$br(),
|
|
||||||
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::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() # ,
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# IDEAFilter::IDEAFilter_ui("data_filter") # ,
|
|
||||||
# shiny::actionButton("save_filter", "Apply the filter")
|
|
||||||
)
|
|
||||||
# datamods::update_variables_ui("vars_update")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Filter",
|
|
||||||
tags$h3("Data filtering"),
|
|
||||||
fluidRow(
|
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
shiny::tags$p(
|
|
||||||
"Below is a short summary table of the provided data.
|
|
||||||
On the right hand side you have the option to create filters.
|
|
||||||
At the bottom you'll find a raw overview of the original vs the modified data."
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
fluidRow(
|
shiny::tags$br(),
|
||||||
# column(
|
shiny::tags$br(),
|
||||||
# width = 3,
|
tags$h4("Restore"),
|
||||||
# shiny::uiOutput("filter_vars"),
|
shiny::tags$br(),
|
||||||
# shiny::conditionalPanel(
|
shiny::tags$p(
|
||||||
# condition = "(typeof input.filter_vars !== 'undefined' && input.filter_vars.length > 0)",
|
"Below, you'll find a raw overview of the original vs the modified data."
|
||||||
# datamods::filter_data_ui("filtering", max_height = "500px")
|
|
||||||
# )
|
|
||||||
# ),
|
|
||||||
# column(
|
|
||||||
# width = 9,
|
|
||||||
# DT::DTOutput(outputId = "filtered_table"),
|
|
||||||
# tags$b("Code dplyr:"),
|
|
||||||
# verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
shiny::column(
|
|
||||||
width = 9,
|
|
||||||
data_summary_ui(id = "data_summary")
|
|
||||||
),
|
|
||||||
shiny::column(
|
|
||||||
width = 3,
|
|
||||||
IDEAFilter::IDEAFilter_ui("data_filter"),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$b("Filter code:"),
|
|
||||||
# shiny::verbatimTextOutput(outputId = "filtered_code"),
|
|
||||||
shiny::tags$br()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Restore",
|
|
||||||
tags$h3("Compare to original and restore"),
|
|
||||||
fluidRow(
|
|
||||||
shiny::column(
|
|
||||||
width = 9,
|
|
||||||
shiny::tags$p(
|
|
||||||
"Right below, you have the option to restore to the originally imported data.
|
|
||||||
At the bottom you'll find a raw overview of the original vs the modified data."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
shiny::tags$br(),
|
|
||||||
tags$h4("Restore"),
|
|
||||||
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::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
column(
|
column(
|
||||||
width = 6,
|
width = 6,
|
||||||
|
@ -239,64 +246,7 @@ ui_elements <- list(
|
||||||
verbatimTextOutput("modified_str")
|
verbatimTextOutput("modified_str")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
|
||||||
bslib::nav_panel(
|
|
||||||
title = "Browse",
|
|
||||||
tags$h3("Browse the provided data"),
|
|
||||||
shiny::tags$p(
|
|
||||||
"Below is a table with all the modified data provided to browse and understand data."
|
|
||||||
),
|
|
||||||
shinyWidgets::html_dependency_winbox(),
|
|
||||||
# fluidRow(
|
|
||||||
# column(
|
|
||||||
# width = 3,
|
|
||||||
# shiny::uiOutput("filter_vars"),
|
|
||||||
# shiny::conditionalPanel(
|
|
||||||
# condition = "(typeof input.filter_vars !== 'undefined' && input.filter_vars.length > 0)",
|
|
||||||
# datamods::filter_data_ui("filtering", max_height = "500px")
|
|
||||||
# )
|
|
||||||
# ),
|
|
||||||
# column(
|
|
||||||
# width = 9,
|
|
||||||
# DT::DTOutput(outputId = "filtered_table"),
|
|
||||||
# tags$b("Code dplyr:"),
|
|
||||||
# verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
# shiny::column(
|
|
||||||
# width = 8,
|
|
||||||
fluidRow(
|
|
||||||
toastui::datagridOutput(outputId = "table_mod")
|
|
||||||
),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::tags$br()
|
|
||||||
# ,
|
|
||||||
# shiny::tags$b("Reproducible code:"),
|
|
||||||
# shiny::verbatimTextOutput(outputId = "filtered_code")
|
|
||||||
# ),
|
|
||||||
# shiny::column(
|
|
||||||
# width = 4,
|
|
||||||
# shiny::actionButton("modal_cut", "Create factor from a variable"),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::tags$br(),
|
|
||||||
# shiny::actionButton("modal_update", "Reorder factor levels")#,
|
|
||||||
# # shiny::tags$br(),
|
|
||||||
# # shiny::tags$br(),
|
|
||||||
# # IDEAFilter::IDEAFilter_ui("data_filter") # ,
|
|
||||||
# # shiny::actionButton("save_filter", "Apply the filter")
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# column(
|
|
||||||
# 8,
|
|
||||||
# shiny::verbatimTextOutput("filtered_code"),
|
|
||||||
# DT::DTOutput("filtered_table")
|
|
||||||
# ),
|
|
||||||
# column(4, IDEAFilter::IDEAFilter_ui("data_filter"))
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
@ -310,8 +260,6 @@ ui_elements <- list(
|
||||||
id = "navdescribe",
|
id = "navdescribe",
|
||||||
bslib::navset_bar(
|
bslib::navset_bar(
|
||||||
title = "",
|
title = "",
|
||||||
# bslib::layout_sidebar(
|
|
||||||
# fillable = TRUE,
|
|
||||||
sidebar = bslib::sidebar(
|
sidebar = bslib::sidebar(
|
||||||
bslib::accordion(
|
bslib::accordion(
|
||||||
open = "acc_chars",
|
open = "acc_chars",
|
||||||
|
@ -522,70 +470,70 @@ ui_elements <- list(
|
||||||
shiny::column(width = 2),
|
shiny::column(width = 2),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 8,
|
width = 8,
|
||||||
shiny::fluidRow(
|
shiny::fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 6,
|
width = 6,
|
||||||
shiny::h4("Report"),
|
shiny::h4("Report"),
|
||||||
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::selectInput(
|
shiny::selectInput(
|
||||||
inputId = "output_type",
|
inputId = "output_type",
|
||||||
label = "Output format",
|
label = "Output format",
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
choices = list(
|
choices = list(
|
||||||
"MS Word" = "docx",
|
"MS Word" = "docx",
|
||||||
"LibreOffice" = "odt"
|
"LibreOffice" = "odt"
|
||||||
# ,
|
# ,
|
||||||
# "PDF" = "pdf",
|
# "PDF" = "pdf",
|
||||||
# "All the above" = "all"
|
# "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(),
|
||||||
# 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::tags$b("Code snippets:"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_import"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_data"),
|
||||||
|
shiny::verbatimTextOutput(outputId = "code_filter"),
|
||||||
|
shiny::tags$br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::selectInput(
|
shiny::column(width = 2)
|
||||||
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::tags$b("Code snippets:"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_import"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_data"),
|
|
||||||
shiny::verbatimTextOutput(outputId = "code_filter"),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::br(),
|
|
||||||
shiny::column(width = 2)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Reference in a new issue