mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 01:49:39 +02:00
This commit is contained in:
parent
013fc19d04
commit
136480ca3d
7 changed files with 184 additions and 80 deletions
|
@ -16,9 +16,13 @@ data_correlations_ui <- function(id, ...) {
|
||||||
|
|
||||||
|
|
||||||
#'
|
#'
|
||||||
|
#' @param id id
|
||||||
#' @param data data
|
#' @param data data
|
||||||
#' @param color.main main color
|
#' @param include.class character vector of classes to include. Default is NULL
|
||||||
#' @param color.sec secondary color
|
#' @param cutoff numeric
|
||||||
|
#' @param warning_str Character string. Exposed to allow dynamic translations
|
||||||
|
#' @param warning_no_str Character string. Exposed to allow dynamic translations
|
||||||
|
#' @param and_strCharacter string. Exposed to allow dynamic translations
|
||||||
#' @param ... arguments passed to toastui::datagrid
|
#' @param ... arguments passed to toastui::datagrid
|
||||||
#'
|
#'
|
||||||
#' @name data-correlations
|
#' @name data-correlations
|
||||||
|
@ -28,6 +32,9 @@ data_correlations_server <- function(id,
|
||||||
data,
|
data,
|
||||||
include.class = NULL,
|
include.class = NULL,
|
||||||
cutoff = .7,
|
cutoff = .7,
|
||||||
|
warning_str = i18n$t("The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent."),
|
||||||
|
warning_no_str = i18n$t("No variables have a correlation measure above the threshold."),
|
||||||
|
and_str = i18n$t("and"),
|
||||||
...) {
|
...) {
|
||||||
shiny::moduleServer(
|
shiny::moduleServer(
|
||||||
id = id,
|
id = id,
|
||||||
|
@ -59,17 +66,17 @@ data_correlations_server <- function(id,
|
||||||
shiny::req(cutoff)
|
shiny::req(cutoff)
|
||||||
pairs <- correlation_pairs(rv$data(), threshold = cutoff())
|
pairs <- correlation_pairs(rv$data(), threshold = cutoff())
|
||||||
|
|
||||||
more <- ifelse(nrow(pairs) > 1, "from each pair ", "")
|
more <- ifelse(nrow(pairs) > 1, i18n$t("from each pair"), "")
|
||||||
|
|
||||||
if (nrow(pairs) == 0) {
|
if (nrow(pairs) == 0) {
|
||||||
out <- glue::glue("No variables have a correlation measure above the threshold.")
|
out <- glue::glue(warning_no_str)
|
||||||
} else {
|
} else {
|
||||||
out <- pairs |>
|
out <- pairs |>
|
||||||
apply(1, \(.x){
|
apply(1, \(.x){
|
||||||
glue::glue("'{.x[1]}'x'{.x[2]}'({round(as.numeric(.x[3]),2)})")
|
glue::glue("'{.x[1]}'x'{.x[2]}' ({round(as.numeric(.x[3]),2)})")
|
||||||
}) |>
|
}) |>
|
||||||
(\(.x){
|
(\(.x){
|
||||||
glue::glue("The following variable pairs are highly correlated: {sentence_paste(.x)}.\nConsider excluding one {more}from the dataset to ensure variables are independent.")
|
glue::glue(warning_str)
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
out
|
out
|
||||||
|
|
|
@ -20,7 +20,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
title = "Creating plot",
|
title = "Creating plot",
|
||||||
icon = bsicons::bs_icon("graph-up"),
|
icon = bsicons::bs_icon("graph-up"),
|
||||||
shiny::uiOutput(outputId = ns("primary")),
|
shiny::uiOutput(outputId = ns("primary")),
|
||||||
shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'),
|
shiny::helpText(i18n$t('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.')),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::uiOutput(outputId = ns("type")),
|
shiny::uiOutput(outputId = ns("type")),
|
||||||
shiny::uiOutput(outputId = ns("secondary")),
|
shiny::uiOutput(outputId = ns("secondary")),
|
||||||
|
@ -28,19 +28,19 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = ns("act_plot"),
|
inputId = ns("act_plot"),
|
||||||
label = "Plot",
|
label = i18n$t("Plot"),
|
||||||
width = "100%",
|
width = "100%",
|
||||||
icon = shiny::icon("palette"),
|
icon = shiny::icon("palette"),
|
||||||
disabled = FALSE
|
disabled = FALSE
|
||||||
),
|
),
|
||||||
shiny::helpText('Adjust settings, then press "Plot".')
|
shiny::helpText(i18n$t('Adjust settings, then press "Plot".'))
|
||||||
),
|
),
|
||||||
bslib::accordion_panel(
|
bslib::accordion_panel(
|
||||||
title = "Download",
|
title = "Download",
|
||||||
icon = bsicons::bs_icon("download"),
|
icon = bsicons::bs_icon("download"),
|
||||||
shinyWidgets::noUiSliderInput(
|
shinyWidgets::noUiSliderInput(
|
||||||
inputId = ns("height_slide"),
|
inputId = ns("height_slide"),
|
||||||
label = "Plot height (mm)",
|
label = i18n$t("Plot height (mm)"),
|
||||||
min = 50,
|
min = 50,
|
||||||
max = 300,
|
max = 300,
|
||||||
value = 100,
|
value = 100,
|
||||||
|
@ -58,7 +58,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
# ),
|
# ),
|
||||||
shinyWidgets::noUiSliderInput(
|
shinyWidgets::noUiSliderInput(
|
||||||
inputId = ns("width"),
|
inputId = ns("width"),
|
||||||
label = "Plot width (mm)",
|
label = i18n$t("Plot width (mm)"),
|
||||||
min = 50,
|
min = 50,
|
||||||
max = 300,
|
max = 300,
|
||||||
value = 100,
|
value = 100,
|
||||||
|
@ -68,7 +68,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
),
|
),
|
||||||
shiny::selectInput(
|
shiny::selectInput(
|
||||||
inputId = ns("plot_type"),
|
inputId = ns("plot_type"),
|
||||||
label = "File format",
|
label = i18n$t("File format"),
|
||||||
choices = list(
|
choices = list(
|
||||||
"png",
|
"png",
|
||||||
"tiff",
|
"tiff",
|
||||||
|
@ -82,7 +82,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
# Button
|
# Button
|
||||||
shiny::downloadButton(
|
shiny::downloadButton(
|
||||||
outputId = ns("download_plot"),
|
outputId = ns("download_plot"),
|
||||||
label = "Download plot",
|
label = i18n$t("Download plot"),
|
||||||
icon = shiny::icon("download")
|
icon = shiny::icon("download")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -225,8 +225,8 @@ data_visuals_server <- function(id,
|
||||||
inputId = ns("primary"),
|
inputId = ns("primary"),
|
||||||
col_subset = names(data())[sapply(data(), data_type) != "text"],
|
col_subset = names(data())[sapply(data(), data_type) != "text"],
|
||||||
data = data,
|
data = data,
|
||||||
placeholder = "Select variable",
|
placeholder = i18n$t("Select variable"),
|
||||||
label = "Response variable",
|
label = i18n$t("Response variable"),
|
||||||
multiple = FALSE
|
multiple = FALSE
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -263,7 +263,7 @@ data_visuals_server <- function(id,
|
||||||
vectorSelectInput(
|
vectorSelectInput(
|
||||||
inputId = ns("type"),
|
inputId = ns("type"),
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
label = shiny::h4("Plot type"),
|
label = shiny::h4(i18n$t("Plot type")),
|
||||||
choices = Reduce(c, plots_named),
|
choices = Reduce(c, plots_named),
|
||||||
multiple = FALSE
|
multiple = FALSE
|
||||||
)
|
)
|
||||||
|
@ -291,12 +291,12 @@ data_visuals_server <- function(id,
|
||||||
inputId = ns("secondary"),
|
inputId = ns("secondary"),
|
||||||
data = data,
|
data = data,
|
||||||
selected = cols[1],
|
selected = cols[1],
|
||||||
placeholder = "Please select",
|
placeholder = i18n$t("Please select"),
|
||||||
label = if (isTRUE(rv$plot.params()[["secondary.multi"]])) "Additional variables" else "Secondary variable",
|
label = if (isTRUE(rv$plot.params()[["secondary.multi"]])) i18n$t("Additional variables") else i18n$t("Secondary variable"),
|
||||||
multiple = rv$plot.params()[["secondary.multi"]],
|
multiple = rv$plot.params()[["secondary.multi"]],
|
||||||
maxItems = rv$plot.params()[["secondary.max"]],
|
maxItems = rv$plot.params()[["secondary.max"]],
|
||||||
col_subset = cols,
|
col_subset = cols,
|
||||||
none_label = "No variable"
|
none_label = i18n$t("No variable")
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -305,8 +305,8 @@ data_visuals_server <- function(id,
|
||||||
columnSelectInput(
|
columnSelectInput(
|
||||||
inputId = ns("tertiary"),
|
inputId = ns("tertiary"),
|
||||||
data = data,
|
data = data,
|
||||||
placeholder = "Please select",
|
placeholder = i18n$t("Please select"),
|
||||||
label = "Grouping variable",
|
label = i18n$t("Grouping variable"),
|
||||||
multiple = FALSE,
|
multiple = FALSE,
|
||||||
col_subset = c(
|
col_subset = c(
|
||||||
"none",
|
"none",
|
||||||
|
@ -319,7 +319,7 @@ data_visuals_server <- function(id,
|
||||||
input$secondary
|
input$secondary
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
none_label = "No stratification"
|
none_label = i18n$t("No stratification")
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ data_visuals_server <- function(id,
|
||||||
ter = input$tertiary
|
ter = input$tertiary
|
||||||
)
|
)
|
||||||
|
|
||||||
shiny::withProgress(message = "Drawing the plot. Hold tight for a moment..", {
|
shiny::withProgress(message = i18n$t("Drawing the plot. Hold tight for a moment.."), {
|
||||||
rv$plot <- rlang::exec(
|
rv$plot <- rlang::exec(
|
||||||
create_plot,
|
create_plot,
|
||||||
!!!append_list(
|
!!!append_list(
|
||||||
|
@ -362,7 +362,7 @@ data_visuals_server <- function(id,
|
||||||
|
|
||||||
output$code_plot <- shiny::renderUI({
|
output$code_plot <- shiny::renderUI({
|
||||||
shiny::req(rv$code)
|
shiny::req(rv$code)
|
||||||
prismCodeBlock(paste0("#Plotting\n", rv$code))
|
prismCodeBlock(paste0(i18n$t("#Plotting\n"), rv$code))
|
||||||
})
|
})
|
||||||
|
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
|
@ -407,7 +407,7 @@ data_visuals_server <- function(id,
|
||||||
plot <- rv$plot[[1]]
|
plot <- rv$plot[[1]]
|
||||||
}
|
}
|
||||||
# browser()
|
# browser()
|
||||||
shiny::withProgress(message = "Drawing the plot. Hold on for a moment..", {
|
shiny::withProgress(message = i18n$t("Drawing the plot. Hold on for a moment.."), {
|
||||||
ggplot2::ggsave(
|
ggplot2::ggsave(
|
||||||
filename = file,
|
filename = file,
|
||||||
plot = plot,
|
plot = plot,
|
||||||
|
@ -486,8 +486,8 @@ supported_plots <- function() {
|
||||||
list(
|
list(
|
||||||
plot_hbars = list(
|
plot_hbars = list(
|
||||||
fun = "plot_hbars",
|
fun = "plot_hbars",
|
||||||
descr = "Stacked horizontal bars",
|
descr = i18n$t("Stacked horizontal bars"),
|
||||||
note = "A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars",
|
note = i18n$t("A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -496,8 +496,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_violin = list(
|
plot_violin = list(
|
||||||
fun = "plot_violin",
|
fun = "plot_violin",
|
||||||
descr = "Violin plot",
|
descr = i18n$t("Violin plot"),
|
||||||
note = "A modern alternative to the classic boxplot to visualise data distribution",
|
note = i18n$t("A modern alternative to the classic boxplot to visualise data distribution"),
|
||||||
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -514,8 +514,8 @@ supported_plots <- function() {
|
||||||
# ),
|
# ),
|
||||||
plot_sankey = list(
|
plot_sankey = list(
|
||||||
fun = "plot_sankey",
|
fun = "plot_sankey",
|
||||||
descr = "Sankey plot",
|
descr = i18n$t("Sankey plot"),
|
||||||
note = "A way of visualising change between groups",
|
note = i18n$t("A way of visualising change between groups"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -524,8 +524,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_scatter = list(
|
plot_scatter = list(
|
||||||
fun = "plot_scatter",
|
fun = "plot_scatter",
|
||||||
descr = "Scatter plot",
|
descr = i18n$t("Scatter plot"),
|
||||||
note = "A classic way of showing the association between to variables",
|
note = i18n$t("A classic way of showing the association between to variables"),
|
||||||
primary.type = c("datatime", "continuous"),
|
primary.type = c("datatime", "continuous"),
|
||||||
secondary.type = c("datatime", "continuous", "categorical"),
|
secondary.type = c("datatime", "continuous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -534,8 +534,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_box = list(
|
plot_box = list(
|
||||||
fun = "plot_box",
|
fun = "plot_box",
|
||||||
descr = "Box plot",
|
descr = i18n$t("Box plot"),
|
||||||
note = "A classic way to plot data distribution by groups",
|
note = i18n$t("A classic way to plot data distribution by groups"),
|
||||||
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -544,8 +544,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_euler = list(
|
plot_euler = list(
|
||||||
fun = "plot_euler",
|
fun = "plot_euler",
|
||||||
descr = "Euler diagram",
|
descr = i18n$t("Euler diagram"),
|
||||||
note = "Generate area-proportional Euler diagrams to display set relationships",
|
note = i18n$t("Generate area-proportional Euler diagrams to display set relationships"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = TRUE,
|
secondary.multi = TRUE,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
hosted_version <- function()'v25.8.3-250910'
|
hosted_version <- function()'v25.8.3-250911'
|
||||||
|
|
|
@ -228,9 +228,13 @@ data_correlations_ui <- function(id, ...) {
|
||||||
|
|
||||||
|
|
||||||
#'
|
#'
|
||||||
|
#' @param id id
|
||||||
#' @param data data
|
#' @param data data
|
||||||
#' @param color.main main color
|
#' @param include.class character vector of classes to include. Default is NULL
|
||||||
#' @param color.sec secondary color
|
#' @param cutoff numeric
|
||||||
|
#' @param warning_str Character string. Exposed to allow dynamic translations
|
||||||
|
#' @param warning_no_str Character string. Exposed to allow dynamic translations
|
||||||
|
#' @param and_strCharacter string. Exposed to allow dynamic translations
|
||||||
#' @param ... arguments passed to toastui::datagrid
|
#' @param ... arguments passed to toastui::datagrid
|
||||||
#'
|
#'
|
||||||
#' @name data-correlations
|
#' @name data-correlations
|
||||||
|
@ -240,6 +244,9 @@ data_correlations_server <- function(id,
|
||||||
data,
|
data,
|
||||||
include.class = NULL,
|
include.class = NULL,
|
||||||
cutoff = .7,
|
cutoff = .7,
|
||||||
|
warning_str = i18n$t("The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent."),
|
||||||
|
warning_no_str = i18n$t("No variables have a correlation measure above the threshold."),
|
||||||
|
and_str = i18n$t("and"),
|
||||||
...) {
|
...) {
|
||||||
shiny::moduleServer(
|
shiny::moduleServer(
|
||||||
id = id,
|
id = id,
|
||||||
|
@ -271,17 +278,17 @@ data_correlations_server <- function(id,
|
||||||
shiny::req(cutoff)
|
shiny::req(cutoff)
|
||||||
pairs <- correlation_pairs(rv$data(), threshold = cutoff())
|
pairs <- correlation_pairs(rv$data(), threshold = cutoff())
|
||||||
|
|
||||||
more <- ifelse(nrow(pairs) > 1, "from each pair ", "")
|
more <- ifelse(nrow(pairs) > 1, i18n$t("from each pair"), "")
|
||||||
|
|
||||||
if (nrow(pairs) == 0) {
|
if (nrow(pairs) == 0) {
|
||||||
out <- glue::glue("No variables have a correlation measure above the threshold.")
|
out <- glue::glue(warning_no_str)
|
||||||
} else {
|
} else {
|
||||||
out <- pairs |>
|
out <- pairs |>
|
||||||
apply(1, \(.x){
|
apply(1, \(.x){
|
||||||
glue::glue("'{.x[1]}'x'{.x[2]}'({round(as.numeric(.x[3]),2)})")
|
glue::glue("'{.x[1]}'x'{.x[2]}' ({round(as.numeric(.x[3]),2)})")
|
||||||
}) |>
|
}) |>
|
||||||
(\(.x){
|
(\(.x){
|
||||||
glue::glue("The following variable pairs are highly correlated: {sentence_paste(.x)}.\nConsider excluding one {more}from the dataset to ensure variables are independent.")
|
glue::glue(warning_str)
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
out
|
out
|
||||||
|
@ -1633,7 +1640,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
title = "Creating plot",
|
title = "Creating plot",
|
||||||
icon = bsicons::bs_icon("graph-up"),
|
icon = bsicons::bs_icon("graph-up"),
|
||||||
shiny::uiOutput(outputId = ns("primary")),
|
shiny::uiOutput(outputId = ns("primary")),
|
||||||
shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'),
|
shiny::helpText(i18n$t('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.')),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::uiOutput(outputId = ns("type")),
|
shiny::uiOutput(outputId = ns("type")),
|
||||||
shiny::uiOutput(outputId = ns("secondary")),
|
shiny::uiOutput(outputId = ns("secondary")),
|
||||||
|
@ -1641,19 +1648,19 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = ns("act_plot"),
|
inputId = ns("act_plot"),
|
||||||
label = "Plot",
|
label = i18n$t("Plot"),
|
||||||
width = "100%",
|
width = "100%",
|
||||||
icon = shiny::icon("palette"),
|
icon = shiny::icon("palette"),
|
||||||
disabled = FALSE
|
disabled = FALSE
|
||||||
),
|
),
|
||||||
shiny::helpText('Adjust settings, then press "Plot".')
|
shiny::helpText(i18n$t('Adjust settings, then press "Plot".'))
|
||||||
),
|
),
|
||||||
bslib::accordion_panel(
|
bslib::accordion_panel(
|
||||||
title = "Download",
|
title = "Download",
|
||||||
icon = bsicons::bs_icon("download"),
|
icon = bsicons::bs_icon("download"),
|
||||||
shinyWidgets::noUiSliderInput(
|
shinyWidgets::noUiSliderInput(
|
||||||
inputId = ns("height_slide"),
|
inputId = ns("height_slide"),
|
||||||
label = "Plot height (mm)",
|
label = i18n$t("Plot height (mm)"),
|
||||||
min = 50,
|
min = 50,
|
||||||
max = 300,
|
max = 300,
|
||||||
value = 100,
|
value = 100,
|
||||||
|
@ -1671,7 +1678,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
# ),
|
# ),
|
||||||
shinyWidgets::noUiSliderInput(
|
shinyWidgets::noUiSliderInput(
|
||||||
inputId = ns("width"),
|
inputId = ns("width"),
|
||||||
label = "Plot width (mm)",
|
label = i18n$t("Plot width (mm)"),
|
||||||
min = 50,
|
min = 50,
|
||||||
max = 300,
|
max = 300,
|
||||||
value = 100,
|
value = 100,
|
||||||
|
@ -1681,7 +1688,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
),
|
),
|
||||||
shiny::selectInput(
|
shiny::selectInput(
|
||||||
inputId = ns("plot_type"),
|
inputId = ns("plot_type"),
|
||||||
label = "File format",
|
label = i18n$t("File format"),
|
||||||
choices = list(
|
choices = list(
|
||||||
"png",
|
"png",
|
||||||
"tiff",
|
"tiff",
|
||||||
|
@ -1695,7 +1702,7 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) {
|
||||||
# Button
|
# Button
|
||||||
shiny::downloadButton(
|
shiny::downloadButton(
|
||||||
outputId = ns("download_plot"),
|
outputId = ns("download_plot"),
|
||||||
label = "Download plot",
|
label = i18n$t("Download plot"),
|
||||||
icon = shiny::icon("download")
|
icon = shiny::icon("download")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1838,8 +1845,8 @@ data_visuals_server <- function(id,
|
||||||
inputId = ns("primary"),
|
inputId = ns("primary"),
|
||||||
col_subset = names(data())[sapply(data(), data_type) != "text"],
|
col_subset = names(data())[sapply(data(), data_type) != "text"],
|
||||||
data = data,
|
data = data,
|
||||||
placeholder = "Select variable",
|
placeholder = i18n$t("Select variable"),
|
||||||
label = "Response variable",
|
label = i18n$t("Response variable"),
|
||||||
multiple = FALSE
|
multiple = FALSE
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1876,7 +1883,7 @@ data_visuals_server <- function(id,
|
||||||
vectorSelectInput(
|
vectorSelectInput(
|
||||||
inputId = ns("type"),
|
inputId = ns("type"),
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
label = shiny::h4("Plot type"),
|
label = shiny::h4(i18n$t("Plot type")),
|
||||||
choices = Reduce(c, plots_named),
|
choices = Reduce(c, plots_named),
|
||||||
multiple = FALSE
|
multiple = FALSE
|
||||||
)
|
)
|
||||||
|
@ -1904,12 +1911,12 @@ data_visuals_server <- function(id,
|
||||||
inputId = ns("secondary"),
|
inputId = ns("secondary"),
|
||||||
data = data,
|
data = data,
|
||||||
selected = cols[1],
|
selected = cols[1],
|
||||||
placeholder = "Please select",
|
placeholder = i18n$t("Please select"),
|
||||||
label = if (isTRUE(rv$plot.params()[["secondary.multi"]])) "Additional variables" else "Secondary variable",
|
label = if (isTRUE(rv$plot.params()[["secondary.multi"]])) i18n$t("Additional variables") else i18n$t("Secondary variable"),
|
||||||
multiple = rv$plot.params()[["secondary.multi"]],
|
multiple = rv$plot.params()[["secondary.multi"]],
|
||||||
maxItems = rv$plot.params()[["secondary.max"]],
|
maxItems = rv$plot.params()[["secondary.max"]],
|
||||||
col_subset = cols,
|
col_subset = cols,
|
||||||
none_label = "No variable"
|
none_label = i18n$t("No variable")
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1918,8 +1925,8 @@ data_visuals_server <- function(id,
|
||||||
columnSelectInput(
|
columnSelectInput(
|
||||||
inputId = ns("tertiary"),
|
inputId = ns("tertiary"),
|
||||||
data = data,
|
data = data,
|
||||||
placeholder = "Please select",
|
placeholder = i18n$t("Please select"),
|
||||||
label = "Grouping variable",
|
label = i18n$t("Grouping variable"),
|
||||||
multiple = FALSE,
|
multiple = FALSE,
|
||||||
col_subset = c(
|
col_subset = c(
|
||||||
"none",
|
"none",
|
||||||
|
@ -1932,7 +1939,7 @@ data_visuals_server <- function(id,
|
||||||
input$secondary
|
input$secondary
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
none_label = "No stratification"
|
none_label = i18n$t("No stratification")
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1948,7 +1955,7 @@ data_visuals_server <- function(id,
|
||||||
ter = input$tertiary
|
ter = input$tertiary
|
||||||
)
|
)
|
||||||
|
|
||||||
shiny::withProgress(message = "Drawing the plot. Hold tight for a moment..", {
|
shiny::withProgress(message = i18n$t("Drawing the plot. Hold tight for a moment.."), {
|
||||||
rv$plot <- rlang::exec(
|
rv$plot <- rlang::exec(
|
||||||
create_plot,
|
create_plot,
|
||||||
!!!append_list(
|
!!!append_list(
|
||||||
|
@ -1975,7 +1982,7 @@ data_visuals_server <- function(id,
|
||||||
|
|
||||||
output$code_plot <- shiny::renderUI({
|
output$code_plot <- shiny::renderUI({
|
||||||
shiny::req(rv$code)
|
shiny::req(rv$code)
|
||||||
prismCodeBlock(paste0("#Plotting\n", rv$code))
|
prismCodeBlock(paste0(i18n$t("#Plotting\n"), rv$code))
|
||||||
})
|
})
|
||||||
|
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
|
@ -2020,7 +2027,7 @@ data_visuals_server <- function(id,
|
||||||
plot <- rv$plot[[1]]
|
plot <- rv$plot[[1]]
|
||||||
}
|
}
|
||||||
# browser()
|
# browser()
|
||||||
shiny::withProgress(message = "Drawing the plot. Hold on for a moment..", {
|
shiny::withProgress(message = i18n$t("Drawing the plot. Hold on for a moment.."), {
|
||||||
ggplot2::ggsave(
|
ggplot2::ggsave(
|
||||||
filename = file,
|
filename = file,
|
||||||
plot = plot,
|
plot = plot,
|
||||||
|
@ -2099,8 +2106,8 @@ supported_plots <- function() {
|
||||||
list(
|
list(
|
||||||
plot_hbars = list(
|
plot_hbars = list(
|
||||||
fun = "plot_hbars",
|
fun = "plot_hbars",
|
||||||
descr = "Stacked horizontal bars",
|
descr = i18n$t("Stacked horizontal bars"),
|
||||||
note = "A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars",
|
note = i18n$t("A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -2109,8 +2116,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_violin = list(
|
plot_violin = list(
|
||||||
fun = "plot_violin",
|
fun = "plot_violin",
|
||||||
descr = "Violin plot",
|
descr = i18n$t("Violin plot"),
|
||||||
note = "A modern alternative to the classic boxplot to visualise data distribution",
|
note = i18n$t("A modern alternative to the classic boxplot to visualise data distribution"),
|
||||||
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -2127,8 +2134,8 @@ supported_plots <- function() {
|
||||||
# ),
|
# ),
|
||||||
plot_sankey = list(
|
plot_sankey = list(
|
||||||
fun = "plot_sankey",
|
fun = "plot_sankey",
|
||||||
descr = "Sankey plot",
|
descr = i18n$t("Sankey plot"),
|
||||||
note = "A way of visualising change between groups",
|
note = i18n$t("A way of visualising change between groups"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -2137,8 +2144,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_scatter = list(
|
plot_scatter = list(
|
||||||
fun = "plot_scatter",
|
fun = "plot_scatter",
|
||||||
descr = "Scatter plot",
|
descr = i18n$t("Scatter plot"),
|
||||||
note = "A classic way of showing the association between to variables",
|
note = i18n$t("A classic way of showing the association between to variables"),
|
||||||
primary.type = c("datatime", "continuous"),
|
primary.type = c("datatime", "continuous"),
|
||||||
secondary.type = c("datatime", "continuous", "categorical"),
|
secondary.type = c("datatime", "continuous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -2147,8 +2154,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_box = list(
|
plot_box = list(
|
||||||
fun = "plot_box",
|
fun = "plot_box",
|
||||||
descr = "Box plot",
|
descr = i18n$t("Box plot"),
|
||||||
note = "A classic way to plot data distribution by groups",
|
note = i18n$t("A classic way to plot data distribution by groups"),
|
||||||
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
primary.type = c("datatime", "continuous", "dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = FALSE,
|
secondary.multi = FALSE,
|
||||||
|
@ -2157,8 +2164,8 @@ supported_plots <- function() {
|
||||||
),
|
),
|
||||||
plot_euler = list(
|
plot_euler = list(
|
||||||
fun = "plot_euler",
|
fun = "plot_euler",
|
||||||
descr = "Euler diagram",
|
descr = i18n$t("Euler diagram"),
|
||||||
note = "Generate area-proportional Euler diagrams to display set relationships",
|
note = i18n$t("Generate area-proportional Euler diagrams to display set relationships"),
|
||||||
primary.type = c("dichotomous", "categorical"),
|
primary.type = c("dichotomous", "categorical"),
|
||||||
secondary.type = c("dichotomous", "categorical"),
|
secondary.type = c("dichotomous", "categorical"),
|
||||||
secondary.multi = TRUE,
|
secondary.multi = TRUE,
|
||||||
|
@ -4061,7 +4068,7 @@ simple_snake <- function(data){
|
||||||
#### Current file: /Users/au301842/FreesearchR/R//hosted_version.R
|
#### Current file: /Users/au301842/FreesearchR/R//hosted_version.R
|
||||||
########
|
########
|
||||||
|
|
||||||
hosted_version <- function()'v25.8.3-250910'
|
hosted_version <- function()'v25.8.3-250911'
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
|
@ -11583,7 +11590,11 @@ server <- function(input, output, session) {
|
||||||
)
|
)
|
||||||
|
|
||||||
shiny::observeEvent(
|
shiny::observeEvent(
|
||||||
|
list(
|
||||||
rv_validations$var_filter,
|
rv_validations$var_filter,
|
||||||
|
rv_validations$obs_filter,
|
||||||
|
rv_validations$missings
|
||||||
|
),
|
||||||
{
|
{
|
||||||
validation_server(
|
validation_server(
|
||||||
id = "validation_all",
|
id = "validation_all",
|
||||||
|
|
|
@ -108,3 +108,38 @@
|
||||||
"{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases.","{data_text} har {n} observationer og {n_var} variabler, med {n_complete} ({p_complete} %) komplette cases."
|
"{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases.","{data_text} har {n} observationer og {n_var} variabler, med {n_complete} ({p_complete} %) komplette cases."
|
||||||
"Prepare","Forbered"
|
"Prepare","Forbered"
|
||||||
"At 0, only complete variables are included; at 100, all variables are included.","At 0, only complete variables are included; at 100, all variables are included."
|
"At 0, only complete variables are included; at 100, all variables are included.","At 0, only complete variables are included; at 100, all variables are included."
|
||||||
|
"The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent.","The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent."
|
||||||
|
"No variables have a correlation measure above the threshold.","Ingen variabler er korrelerede over den angivne tærskelværdi."
|
||||||
|
"and","og"
|
||||||
|
"from each pair","fra hvert par"
|
||||||
|
"Only non-text variables are available for plotting. Go the ""Data"" to reclass data to plot.","Only non-text variables are available for plotting. Go the ""Data"" to reclass data to plot."
|
||||||
|
"Plot","Plot"
|
||||||
|
"Adjust settings, then press ""Plot"".","Adjust settings, then press ""Plot""."
|
||||||
|
"Plot height (mm)","Plot height (mm)"
|
||||||
|
"Plot width (mm)","Plot width (mm)"
|
||||||
|
"File format","File format"
|
||||||
|
"Download plot","Download plot"
|
||||||
|
"Select variable","Select variable"
|
||||||
|
"Response variable","Response variable"
|
||||||
|
"Plot type","Plot type"
|
||||||
|
"Please select","Please select"
|
||||||
|
"Additional variables","Additional variables"
|
||||||
|
"Secondary variable","Secondary variable"
|
||||||
|
"No variable","No variable"
|
||||||
|
"Grouping variable","Grouping variable"
|
||||||
|
"No stratification","No stratification"
|
||||||
|
"Drawing the plot. Hold tight for a moment..","Drawing the plot. Hold tight for a moment.."
|
||||||
|
"#Plotting\n","#Plotting\n"
|
||||||
|
"Drawing the plot. Hold on for a moment..","Drawing the plot. Hold on for a moment.."
|
||||||
|
"Stacked horizontal bars","Stacked horizontal bars"
|
||||||
|
"A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars","A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars"
|
||||||
|
"Violin plot","Violin plot"
|
||||||
|
"A modern alternative to the classic boxplot to visualise data distribution","A modern alternative to the classic boxplot to visualise data distribution"
|
||||||
|
"Sankey plot","Sankey plot"
|
||||||
|
"A way of visualising change between groups","A way of visualising change between groups"
|
||||||
|
"Scatter plot","Scatter plot"
|
||||||
|
"A classic way of showing the association between to variables","A classic way of showing the association between to variables"
|
||||||
|
"Box plot","Box plot"
|
||||||
|
"A classic way to plot data distribution by groups","A classic way to plot data distribution by groups"
|
||||||
|
"Euler diagram","Euler diagram"
|
||||||
|
"Generate area-proportional Euler diagrams to display set relationships","Generate area-proportional Euler diagrams to display set relationships"
|
||||||
|
|
|
|
@ -108,3 +108,38 @@
|
||||||
"{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases.","{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases."
|
"{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases.","{data_text} has {n} observations and {n_var} variables, with {n_complete} ({p_complete} %) complete cases."
|
||||||
"Prepare","Prepare"
|
"Prepare","Prepare"
|
||||||
"At 0, only complete variables are included; at 100, all variables are included.","At 0, only complete variables are included; at 100, all variables are included."
|
"At 0, only complete variables are included; at 100, all variables are included.","At 0, only complete variables are included; at 100, all variables are included."
|
||||||
|
"The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent.","The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\nConsider excluding one {more}from the dataset to ensure variables are independent."
|
||||||
|
"No variables have a correlation measure above the threshold.","No variables have a correlation measure above the threshold."
|
||||||
|
"and","and"
|
||||||
|
"from each pair","from each pair"
|
||||||
|
"Only non-text variables are available for plotting. Go the ""Data"" to reclass data to plot.","Only non-text variables are available for plotting. Go the ""Data"" to reclass data to plot."
|
||||||
|
"Plot","Plot"
|
||||||
|
"Adjust settings, then press ""Plot"".","Adjust settings, then press ""Plot""."
|
||||||
|
"Plot height (mm)","Plot height (mm)"
|
||||||
|
"Plot width (mm)","Plot width (mm)"
|
||||||
|
"File format","File format"
|
||||||
|
"Download plot","Download plot"
|
||||||
|
"Select variable","Select variable"
|
||||||
|
"Response variable","Response variable"
|
||||||
|
"Plot type","Plot type"
|
||||||
|
"Please select","Please select"
|
||||||
|
"Additional variables","Additional variables"
|
||||||
|
"Secondary variable","Secondary variable"
|
||||||
|
"No variable","No variable"
|
||||||
|
"Grouping variable","Grouping variable"
|
||||||
|
"No stratification","No stratification"
|
||||||
|
"Drawing the plot. Hold tight for a moment..","Drawing the plot. Hold tight for a moment.."
|
||||||
|
"#Plotting\n","#Plotting\n"
|
||||||
|
"Drawing the plot. Hold on for a moment..","Drawing the plot. Hold on for a moment.."
|
||||||
|
"Stacked horizontal bars","Stacked horizontal bars"
|
||||||
|
"A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars","A classical way of visualising the distribution of an ordinal scale like the modified Ranking Scale and known as Grotta bars"
|
||||||
|
"Violin plot","Violin plot"
|
||||||
|
"A modern alternative to the classic boxplot to visualise data distribution","A modern alternative to the classic boxplot to visualise data distribution"
|
||||||
|
"Sankey plot","Sankey plot"
|
||||||
|
"A way of visualising change between groups","A way of visualising change between groups"
|
||||||
|
"Scatter plot","Scatter plot"
|
||||||
|
"A classic way of showing the association between to variables","A classic way of showing the association between to variables"
|
||||||
|
"Box plot","Box plot"
|
||||||
|
"A classic way to plot data distribution by groups","A classic way to plot data distribution by groups"
|
||||||
|
"Euler diagram","Euler diagram"
|
||||||
|
"Generate area-proportional Euler diagrams to display set relationships","Generate area-proportional Euler diagrams to display set relationships"
|
||||||
|
|
|
|
@ -8,18 +8,34 @@
|
||||||
\usage{
|
\usage{
|
||||||
data_correlations_ui(id, ...)
|
data_correlations_ui(id, ...)
|
||||||
|
|
||||||
data_correlations_server(id, data, include.class = NULL, cutoff = 0.7, ...)
|
data_correlations_server(
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
include.class = NULL,
|
||||||
|
cutoff = 0.7,
|
||||||
|
warning_str =
|
||||||
|
i18n$t("The following variable pairs are highly correlated: {sentence_paste(.x,and_str)}.\\nConsider excluding one {more}from the dataset to ensure variables are independent."),
|
||||||
|
warning_no_str = i18n$t("No variables have a correlation measure above the threshold."),
|
||||||
|
and_str = i18n$t("and"),
|
||||||
|
...
|
||||||
|
)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{id}{Module id. (Use 'ns("id")')}
|
\item{id}{id}
|
||||||
|
|
||||||
\item{...}{arguments passed to toastui::datagrid}
|
\item{...}{arguments passed to toastui::datagrid}
|
||||||
|
|
||||||
\item{data}{data}
|
\item{data}{data}
|
||||||
|
|
||||||
\item{color.main}{main color}
|
\item{include.class}{character vector of classes to include. Default is NULL}
|
||||||
|
|
||||||
\item{color.sec}{secondary color}
|
\item{cutoff}{numeric}
|
||||||
|
|
||||||
|
\item{warning_str}{Character string. Exposed to allow dynamic translations}
|
||||||
|
|
||||||
|
\item{warning_no_str}{Character string. Exposed to allow dynamic translations}
|
||||||
|
|
||||||
|
\item{and_strCharacter}{string. Exposed to allow dynamic translations}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
Shiny ui module
|
Shiny ui module
|
||||||
|
|
Loading…
Add table
Reference in a new issue