mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 18:09:39 +02:00
manual functions for data import
This commit is contained in:
parent
f9c585a5fe
commit
9f828aa4bd
4 changed files with 54 additions and 21 deletions
|
@ -226,10 +226,13 @@ create_overview_datagrid <- function(data) {
|
||||||
formatter = toastui::JS("function(obj) {return (obj.value*100).toFixed(0) + '%';}")
|
formatter = toastui::JS("function(obj) {return (obj.value*100).toFixed(0) + '%';}")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## This could obviously be extended, which will added even more complexity.
|
||||||
|
|
||||||
grid <- toastui::grid_filters(
|
grid <- toastui::grid_filters(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
columns = "name",
|
column = "name",
|
||||||
showApplyBtn = TRUE,
|
# columns = unname(std_names[std_names!="vals"]),
|
||||||
|
showApplyBtn = FALSE,
|
||||||
showClearBtn = TRUE,
|
showClearBtn = TRUE,
|
||||||
type = "text"
|
type = "text"
|
||||||
)
|
)
|
||||||
|
|
|
@ -694,10 +694,11 @@ data_summary_ui <- function(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#' @param id id
|
#'
|
||||||
#' @param data data
|
#' @param data data
|
||||||
#' @param color.main main color
|
#' @param color.main main color
|
||||||
#' @param color.sec secondary color
|
#' @param color.sec secondary color
|
||||||
|
#' @param ... arguments passed to toastui::datagrid
|
||||||
#'
|
#'
|
||||||
#' @name data-summary
|
#' @name data-summary
|
||||||
#' @returns shiny server module
|
#' @returns shiny server module
|
||||||
|
@ -705,7 +706,8 @@ data_summary_ui <- function(id) {
|
||||||
data_summary_server <- function(id,
|
data_summary_server <- function(id,
|
||||||
data,
|
data,
|
||||||
color.main,
|
color.main,
|
||||||
color.sec) {
|
color.sec,
|
||||||
|
...) {
|
||||||
shiny::moduleServer(
|
shiny::moduleServer(
|
||||||
id = id,
|
id = id,
|
||||||
module = function(input, output, session) {
|
module = function(input, output, session) {
|
||||||
|
@ -906,10 +908,13 @@ create_overview_datagrid <- function(data) {
|
||||||
formatter = toastui::JS("function(obj) {return (obj.value*100).toFixed(0) + '%';}")
|
formatter = toastui::JS("function(obj) {return (obj.value*100).toFixed(0) + '%';}")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## This could obviously be extended, which will added even more complexity.
|
||||||
|
|
||||||
grid <- toastui::grid_filters(
|
grid <- toastui::grid_filters(
|
||||||
grid = grid,
|
grid = grid,
|
||||||
columns = "name",
|
column = "name",
|
||||||
showApplyBtn = TRUE,
|
# columns = unname(std_names[std_names!="vals"]),
|
||||||
|
showApplyBtn = FALSE,
|
||||||
showClearBtn = TRUE,
|
showClearBtn = TRUE,
|
||||||
type = "text"
|
type = "text"
|
||||||
)
|
)
|
||||||
|
@ -3625,7 +3630,7 @@ ui_elements <- list(
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 10,
|
step = 10,
|
||||||
value = 50,
|
value = 70,
|
||||||
ticks = FALSE),
|
ticks = FALSE),
|
||||||
shiny::helpText("To improve speed, columns are removed before analysing data, if copleteness is below above value."),
|
shiny::helpText("To improve speed, columns are removed before analysing data, if copleteness is below above value."),
|
||||||
shiny::radioButtons(
|
shiny::radioButtons(
|
||||||
|
@ -3955,6 +3960,8 @@ server <- function(input, output, session) {
|
||||||
#########
|
#########
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
consider.na <- c("NA", "\"\"", "")
|
||||||
|
|
||||||
data_file <- datamods::import_file_server(
|
data_file <- datamods::import_file_server(
|
||||||
id = "file_import",
|
id = "file_import",
|
||||||
show_data_in = "popup",
|
show_data_in = "popup",
|
||||||
|
@ -3962,13 +3969,22 @@ server <- function(input, output, session) {
|
||||||
return_class = "data.frame",
|
return_class = "data.frame",
|
||||||
read_fns = list(
|
read_fns = list(
|
||||||
ods = function(file) {
|
ods = function(file) {
|
||||||
readODS::read_ods(path = file)
|
readODS::read_ods(path = file, na = consider.na)
|
||||||
},
|
},
|
||||||
dta = function(file) {
|
dta = function(file) {
|
||||||
haven::read_dta(file = file)
|
haven::read_dta(file = file, .name_repair = "unique_quiet")
|
||||||
},
|
},
|
||||||
csv = function(file) {
|
csv = function(file) {
|
||||||
readr::read_csv(file)
|
readr::read_csv(file = file, na = consider.na)
|
||||||
|
},
|
||||||
|
# xls = function(file){
|
||||||
|
# openxlsx2::read_xlsx(file = file, na.strings = consider.na,)
|
||||||
|
# },
|
||||||
|
# xlsx = function(file){
|
||||||
|
# openxlsx2::read_xlsx(file = file, na.strings = consider.na,)
|
||||||
|
# },
|
||||||
|
rds = function(file) {
|
||||||
|
readr::read_rds(file = file)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -4038,7 +4054,8 @@ server <- function(input, output, session) {
|
||||||
rv$data_filtered
|
rv$data_filtered
|
||||||
}),
|
}),
|
||||||
color.main = "#2A004E",
|
color.main = "#2A004E",
|
||||||
color.sec = "#C62300"
|
color.sec = "#C62300",
|
||||||
|
pagination = 20
|
||||||
)
|
)
|
||||||
|
|
||||||
#########
|
#########
|
||||||
|
@ -4155,7 +4172,8 @@ server <- function(input, output, session) {
|
||||||
})() |>
|
})() |>
|
||||||
janitor::remove_empty(
|
janitor::remove_empty(
|
||||||
which = "cols",
|
which = "cols",
|
||||||
cutoff = input$complete_cutoff/100)
|
cutoff = input$complete_cutoff / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ account: agdamsbo
|
||||||
server: shinyapps.io
|
server: shinyapps.io
|
||||||
hostUrl: https://api.shinyapps.io/v1
|
hostUrl: https://api.shinyapps.io/v1
|
||||||
appId: 13611288
|
appId: 13611288
|
||||||
bundleId: 9672388
|
bundleId: 9672500
|
||||||
url: https://agdamsbo.shinyapps.io/freesearcheR/
|
url: https://agdamsbo.shinyapps.io/freesearcheR/
|
||||||
version: 1
|
version: 1
|
||||||
|
|
|
@ -90,6 +90,8 @@ server <- function(input, output, session) {
|
||||||
#########
|
#########
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
consider.na <- c("NA", "\"\"", "")
|
||||||
|
|
||||||
data_file <- datamods::import_file_server(
|
data_file <- datamods::import_file_server(
|
||||||
id = "file_import",
|
id = "file_import",
|
||||||
show_data_in = "popup",
|
show_data_in = "popup",
|
||||||
|
@ -97,13 +99,22 @@ server <- function(input, output, session) {
|
||||||
return_class = "data.frame",
|
return_class = "data.frame",
|
||||||
read_fns = list(
|
read_fns = list(
|
||||||
ods = function(file) {
|
ods = function(file) {
|
||||||
readODS::read_ods(path = file)
|
readODS::read_ods(path = file, na = consider.na)
|
||||||
},
|
},
|
||||||
dta = function(file) {
|
dta = function(file) {
|
||||||
haven::read_dta(file = file)
|
haven::read_dta(file = file, .name_repair = "unique_quiet")
|
||||||
},
|
},
|
||||||
csv = function(file) {
|
csv = function(file) {
|
||||||
readr::read_csv(file)
|
readr::read_csv(file = file, na = consider.na)
|
||||||
|
},
|
||||||
|
# xls = function(file){
|
||||||
|
# openxlsx2::read_xlsx(file = file, na.strings = consider.na,)
|
||||||
|
# },
|
||||||
|
# xlsx = function(file){
|
||||||
|
# openxlsx2::read_xlsx(file = file, na.strings = consider.na,)
|
||||||
|
# },
|
||||||
|
rds = function(file) {
|
||||||
|
readr::read_rds(file = file)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -291,7 +302,8 @@ server <- function(input, output, session) {
|
||||||
})() |>
|
})() |>
|
||||||
janitor::remove_empty(
|
janitor::remove_empty(
|
||||||
which = "cols",
|
which = "cols",
|
||||||
cutoff = input$complete_cutoff/100)
|
cutoff = input$complete_cutoff / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue