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,8 +4947,6 @@ 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::h4("Choose your data source"),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shinyWidgets::radioGroupButtons(
|
shinyWidgets::radioGroupButtons(
|
||||||
|
@ -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,12 +5076,36 @@ ui_elements <- list(
|
||||||
),
|
),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
update_variables_ui("vars_update"),
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 8,
|
||||||
|
fluidRow(
|
||||||
|
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::tags$br()
|
||||||
),
|
),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 3,
|
width = 6,
|
||||||
tags$h4("Create new variables"),
|
tags$h4("Create new variables"),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
|
@ -5021,15 +5117,6 @@ ui_elements <- list(
|
||||||
shiny::helpText("Create factor/categorical variable from an other value."),
|
shiny::helpText("Create factor/categorical variable from an other value."),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
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(
|
shiny::actionButton(
|
||||||
inputId = "modal_column",
|
inputId = "modal_column",
|
||||||
label = "New variable",
|
label = "New variable",
|
||||||
|
@ -5038,69 +5125,9 @@ ui_elements <- list(
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")),
|
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(),
|
|
||||||
# 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(
|
|
||||||
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(
|
|
||||||
# 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 = 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()
|
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"),
|
tags$h4("Restore"),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "data_reset",
|
inputId = "data_reset",
|
||||||
|
@ -5110,6 +5137,19 @@ ui_elements <- list(
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
||||||
),
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 2
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
tags$h4("Restore"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below, you'll find a raw overview of the original vs the modified data."
|
||||||
|
),
|
||||||
|
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",
|
||||||
|
@ -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,8 +29,6 @@ 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::h4("Choose your data source"),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shinyWidgets::radioGroupButtons(
|
shinyWidgets::radioGroupButtons(
|
||||||
|
@ -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,12 +158,36 @@ ui_elements <- list(
|
||||||
),
|
),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 9,
|
width = 2
|
||||||
update_variables_ui("vars_update"),
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 8,
|
||||||
|
fluidRow(
|
||||||
|
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::tags$br()
|
||||||
),
|
),
|
||||||
shiny::column(
|
shiny::column(
|
||||||
width = 3,
|
width = 6,
|
||||||
tags$h4("Create new variables"),
|
tags$h4("Create new variables"),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
|
@ -136,15 +199,6 @@ ui_elements <- list(
|
||||||
shiny::helpText("Create factor/categorical variable from an other value."),
|
shiny::helpText("Create factor/categorical variable from an other value."),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
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(
|
shiny::actionButton(
|
||||||
inputId = "modal_column",
|
inputId = "modal_column",
|
||||||
label = "New variable",
|
label = "New variable",
|
||||||
|
@ -153,69 +207,9 @@ ui_elements <- list(
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")),
|
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(),
|
|
||||||
# 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(
|
|
||||||
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(
|
|
||||||
# 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 = 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()
|
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"),
|
tags$h4("Restore"),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "data_reset",
|
inputId = "data_reset",
|
||||||
|
@ -225,6 +219,19 @@ ui_elements <- list(
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing.")
|
||||||
),
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 2
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
tags$h4("Restore"),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$p(
|
||||||
|
"Below, you'll find a raw overview of the original vs the modified data."
|
||||||
|
),
|
||||||
|
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",
|
||||||
|
|
Loading…
Add table
Reference in a new issue