mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-12-15 00:52:09 +01:00
rendering
This commit is contained in:
parent
913844d34b
commit
747670bb57
9 changed files with 161 additions and 29 deletions
|
|
@ -112,6 +112,7 @@ Collate:
|
|||
'launch_FreesearchR.R'
|
||||
'missings-module.R'
|
||||
'plot-download-module.R'
|
||||
'plot_bar.R'
|
||||
'plot_box.R'
|
||||
'plot_euler.R'
|
||||
'plot_hbar.R'
|
||||
|
|
|
|||
|
|
@ -100,12 +100,14 @@ export(missings_apex_plot)
|
|||
export(missings_validate)
|
||||
export(modal_create_column)
|
||||
export(modal_cut_variable)
|
||||
export(modal_string_split)
|
||||
export(modal_update_factor)
|
||||
export(modal_visual_summary)
|
||||
export(modify_qmd)
|
||||
export(names2val)
|
||||
export(overview_vars)
|
||||
export(pipe_string)
|
||||
export(plot_bar_single)
|
||||
export(plot_box)
|
||||
export(plot_box_single)
|
||||
export(plot_euler)
|
||||
|
|
@ -137,6 +139,8 @@ export(show_data)
|
|||
export(simple_snake)
|
||||
export(sort_by)
|
||||
export(specify_qmd_format)
|
||||
export(string_split_server)
|
||||
export(string_split_ui)
|
||||
export(subset_types)
|
||||
export(supported_functions)
|
||||
export(supported_plots)
|
||||
|
|
|
|||
6
NEWS.md
6
NEWS.md
|
|
@ -1,6 +1,10 @@
|
|||
# FreesearchR 25.10.5
|
||||
|
||||
*NEW* New character/text split function available. A selection of delimiters are recognised and selectable. Function only available if splittable variables are present. This was the last big function to implement after workshops at Jitimai in Zanzibar.
|
||||
*NEW* New character/text split function available. A selection of delimiters are recognised and selectable. Function only available if splittable variables are present.
|
||||
|
||||
*NEW* Distribution plotting for factors have been much improved including two new bar plot styles and removing options better suited for continuous data.
|
||||
|
||||
These were the last major functions to be implemented after workshops at Jitimai in Zanzibar City, Zanzibar during October 2025.
|
||||
|
||||
# FreesearchR 25.10.4
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
hosted_version <- function()'v25.10.5-251030'
|
||||
hosted_version <- function()'v25.10.5-251031'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
#' String split module based on tidyr::separate_
|
||||
#'
|
||||
#' @param id id
|
||||
#'
|
||||
#' @returns A shiny ui module
|
||||
#' @export
|
||||
#'
|
||||
#' @name split-string
|
||||
#'
|
||||
string_split_ui <- function(id) {
|
||||
ns <- NS(id)
|
||||
tagList(
|
||||
|
|
@ -26,17 +35,17 @@ string_split_ui <- function(id) {
|
|||
),
|
||||
shiny::fluidRow(
|
||||
column(
|
||||
width = 3,
|
||||
width = 4,
|
||||
shiny::h4(i18n$t("Original data")),
|
||||
shiny::tableOutput(outputId = ns("orig_data"))
|
||||
toastui::datagridOutput2(outputId = ns("orig_data"))
|
||||
# DT::DTOutput(outputId = ns("orig_data_3"))
|
||||
# This doesn't render...
|
||||
# toastui::datagridOutput2(outputId = ns("orig_data_2"))
|
||||
),
|
||||
column(width = 1),
|
||||
column(
|
||||
width = 8,
|
||||
shiny::h4(i18n$t("Preview of result")),
|
||||
shiny::tableOutput(outputId = ns("new_data"))
|
||||
toastui::datagridOutput2(outputId = ns("new_data"))
|
||||
)
|
||||
),
|
||||
actionButton(
|
||||
|
|
@ -50,11 +59,18 @@ string_split_ui <- function(id) {
|
|||
|
||||
|
||||
|
||||
#' @param data_r reactive data
|
||||
#'
|
||||
#' @returns shiny module server
|
||||
#' @export
|
||||
#'
|
||||
#' @name split-string
|
||||
#'
|
||||
string_split_server <- function(id, data_r = reactive(NULL)) {
|
||||
moduleServer(
|
||||
id,
|
||||
function(input, output, session) {
|
||||
rv <- reactiveValues(data = NULL, temp = NULL, out=NULL)
|
||||
rv <- reactiveValues(data = NULL, target=NULL, temp = NULL, out=NULL)
|
||||
|
||||
ns <- session$ns
|
||||
|
||||
|
|
@ -80,6 +96,8 @@ string_split_server <- function(id, data_r = reactive(NULL)) {
|
|||
}, logical(1))
|
||||
vars_num <- names(vars_num)[vars_num]
|
||||
|
||||
req(length(vars_num)>0)
|
||||
|
||||
output$variable <- shiny::renderUI(
|
||||
columnSelectInput(
|
||||
inputId = ns("variable"),
|
||||
|
|
@ -103,6 +121,7 @@ string_split_server <- function(id, data_r = reactive(NULL)) {
|
|||
req(input$variable)
|
||||
# browser()
|
||||
|
||||
req(input$variable %in% names(rv$data))
|
||||
# req({
|
||||
# any(apply(data_r(),2,is_splittable))
|
||||
# })
|
||||
|
|
@ -180,36 +199,46 @@ string_split_server <- function(id, data_r = reactive(NULL)) {
|
|||
## Toastui would not render the original data, so the solution was to go
|
||||
## with native table rendering, which works, but doesn't please the eye
|
||||
|
||||
output$orig_data <- shiny::renderTable({
|
||||
req(data_r())
|
||||
req(input$variable)
|
||||
data <- data_r() |>
|
||||
dplyr::select(tidyselect::all_of(input$variable))
|
||||
# browser()
|
||||
head(data, 10)
|
||||
})
|
||||
|
||||
# output$orig_data_2 <- toastui::renderDatagrid2({
|
||||
# output$orig_data <- shiny::renderTable({
|
||||
# req(data_r())
|
||||
# req(input$variable)
|
||||
# data <- data_r() |>
|
||||
# dplyr::select(tidyselect::all_of(input$variable))
|
||||
# # browser()
|
||||
# toastui::datagrid(head(data, 10))
|
||||
# head(data, 10)
|
||||
# })
|
||||
|
||||
output$orig_data <- toastui::renderDatagrid2({
|
||||
req(data_r())
|
||||
req(input$variable)
|
||||
|
||||
req(hasName(rv$data, input$variable))
|
||||
|
||||
output$new_data <- shiny::renderTable({
|
||||
data <- data_r() |>
|
||||
dplyr::select(tidyselect::all_of(input$variable)) |>
|
||||
head(30) |>
|
||||
dplyr::mutate(row=dplyr::row_number()) |>
|
||||
dplyr::select(row,tidyselect::everything())
|
||||
# browser()
|
||||
toastui::datagrid(
|
||||
data = data,
|
||||
rowHeight = 40,
|
||||
colwidths = "guess",
|
||||
theme = "default",
|
||||
bodyHeight = "auto",
|
||||
pagination = 10)
|
||||
})
|
||||
|
||||
output$new_data <- toastui::renderDatagrid2({
|
||||
shiny::req(rv$temp)
|
||||
data <- rv$temp
|
||||
head(data, 10)
|
||||
# toastui::datagrid(
|
||||
# data = head(data, 100),
|
||||
# colwidths = "guess",
|
||||
# theme = "default",
|
||||
# bodyHeight = "auto", pagination = 10
|
||||
# )
|
||||
toastui::datagrid(
|
||||
data = head(data, 30),
|
||||
rowHeight = 40,
|
||||
colwidths = "guess",
|
||||
theme = "default",
|
||||
bodyHeight = "auto", pagination = 10
|
||||
)
|
||||
})
|
||||
|
||||
data_split_r <- reactive({
|
||||
|
|
@ -256,6 +285,15 @@ string_split_server <- function(id, data_r = reactive(NULL)) {
|
|||
}
|
||||
|
||||
|
||||
#' @param title Modal title
|
||||
#' @param easyClose easyClose
|
||||
#' @param size size
|
||||
#' @param footer footer
|
||||
#'
|
||||
#' @returns shiny modal
|
||||
#' @export
|
||||
#'
|
||||
#' @name split-string
|
||||
modal_string_split <- function(id,
|
||||
title = i18n$t("Split character string"),
|
||||
easyClose = TRUE,
|
||||
|
|
@ -373,3 +411,40 @@ is_splittable <- function(data) {
|
|||
FALSE
|
||||
}
|
||||
}
|
||||
|
||||
# mtcars |> simple_dt()
|
||||
simple_dt <- function(data,...){
|
||||
headerCallbackRemoveHeaderFooter <- c(
|
||||
"function(thead, data, start, end, display){",
|
||||
" $('th', thead).css('display', 'none');",
|
||||
"}"
|
||||
)
|
||||
|
||||
DT::datatable(
|
||||
data,
|
||||
options = list(
|
||||
dom = "t",
|
||||
ordering = FALSE,
|
||||
paging = FALSE,
|
||||
searching = FALSE,
|
||||
# headerCallback = DT::JS(headerCallbackRemoveHeaderFooter),
|
||||
columnDefs = list(
|
||||
list(
|
||||
targets = 1,
|
||||
render = DT::JS(
|
||||
"function(data, type, row, meta) {",
|
||||
"return type === 'display' && data.length > 10 ?",
|
||||
"'<span title=\"' + data + '\">' + data.substr(0, 10) + '...</span>' : data;",
|
||||
"}")))
|
||||
),
|
||||
selection = 'none',
|
||||
callback = DT::JS(
|
||||
"$('table.dataTable.no-footer').css('border-bottom', 'none');"
|
||||
),
|
||||
class = 'row-border',
|
||||
escape = FALSE,
|
||||
rownames = FALSE,
|
||||
# width = 500,
|
||||
filter = "none"
|
||||
)
|
||||
}
|
||||
|
|
|
|||
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
|
|
@ -11,11 +11,11 @@
|
|||
|collate |en_US.UTF-8 |
|
||||
|ctype |en_US.UTF-8 |
|
||||
|tz |Europe/Copenhagen |
|
||||
|date |2025-10-30 |
|
||||
|date |2025-10-31 |
|
||||
|rstudio |2025.05.0+496 Mariposa Orchid (desktop) |
|
||||
|pandoc |3.6.4 @ /opt/homebrew/bin/ (via rmarkdown) |
|
||||
|quarto |1.7.30 @ /usr/local/bin/quarto |
|
||||
|FreesearchR |25.10.5.251030 |
|
||||
|FreesearchR |25.10.5.251031 |
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
@ -118,12 +118,15 @@
|
|||
|KernSmooth |2.23-26 |2025-01-01 |CRAN (R 4.4.1) |
|
||||
|keyring |1.4.1 |2025-06-15 |CRAN (R 4.4.1) |
|
||||
|knitr |1.50 |2025-03-16 |CRAN (R 4.4.1) |
|
||||
|labeling |0.4.3 |2023-08-29 |CRAN (R 4.4.1) |
|
||||
|later |1.4.2 |2025-04-08 |RSPM (R 4.4.0) |
|
||||
|lattice |0.22-7 |2025-04-02 |CRAN (R 4.4.1) |
|
||||
|lifecycle |1.0.4 |2023-11-07 |CRAN (R 4.4.1) |
|
||||
|litedown |0.7 |2025-04-08 |CRAN (R 4.4.1) |
|
||||
|lme4 |1.1-37 |2025-03-26 |CRAN (R 4.4.1) |
|
||||
|lubridate |1.9.4 |2024-12-08 |CRAN (R 4.4.1) |
|
||||
|magrittr |2.0.3 |2022-03-30 |RSPM (R 4.4.0) |
|
||||
|markdown |2.0 |2025-03-23 |CRAN (R 4.4.1) |
|
||||
|MASS |7.3-65 |2025-02-28 |CRAN (R 4.4.1) |
|
||||
|Matrix |1.7-3 |2025-03-11 |RSPM (R 4.4.0) |
|
||||
|memoise |2.0.1 |2021-11-26 |CRAN (R 4.4.0) |
|
||||
|
|
@ -225,6 +228,7 @@
|
|||
|uuid |1.2-1 |2024-07-29 |CRAN (R 4.4.1) |
|
||||
|V8 |6.0.6 |2025-08-18 |CRAN (R 4.4.1) |
|
||||
|vctrs |0.6.5 |2023-12-01 |CRAN (R 4.4.0) |
|
||||
|viridisLite |0.4.2 |2023-05-02 |CRAN (R 4.4.1) |
|
||||
|vroom |1.6.5 |2023-12-05 |CRAN (R 4.4.0) |
|
||||
|withr |3.0.2 |2024-10-28 |CRAN (R 4.4.1) |
|
||||
|writexl |1.5.4 |2025-04-15 |CRAN (R 4.4.1) |
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
\alias{compare_missings}
|
||||
\title{Pairwise comparison of missings across covariables}
|
||||
\usage{
|
||||
compare_missings(data, by_var)
|
||||
compare_missings(data, by_var, max_level = 20)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{data frame}
|
||||
|
|
|
|||
44
man/split-string.Rd
Normal file
44
man/split-string.Rd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/separate_string.R
|
||||
\name{split-string}
|
||||
\alias{split-string}
|
||||
\alias{string_split_ui}
|
||||
\alias{string_split_server}
|
||||
\alias{modal_string_split}
|
||||
\title{String split module based on tidyr::separate_}
|
||||
\usage{
|
||||
string_split_ui(id)
|
||||
|
||||
string_split_server(id, data_r = reactive(NULL))
|
||||
|
||||
modal_string_split(
|
||||
id,
|
||||
title = i18n$t("Split character string"),
|
||||
easyClose = TRUE,
|
||||
size = "xl",
|
||||
footer = NULL
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{id}{id}
|
||||
|
||||
\item{data_r}{reactive data}
|
||||
|
||||
\item{title}{Modal title}
|
||||
|
||||
\item{easyClose}{easyClose}
|
||||
|
||||
\item{size}{size}
|
||||
|
||||
\item{footer}{footer}
|
||||
}
|
||||
\value{
|
||||
A shiny ui module
|
||||
|
||||
shiny module server
|
||||
|
||||
shiny modal
|
||||
}
|
||||
\description{
|
||||
String split module based on tidyr::separate_
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue