updated data import
Some checks are pending
pkgdown.yaml / pkgdown (push) Waiting to run

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-03-11 13:42:57 +01:00
commit 912fff7474
No known key found for this signature in database
32 changed files with 2340 additions and 273 deletions

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,6 @@ account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 13611288
bundleId: 9899914
bundleId: 9925506
url: https://agdamsbo.shinyapps.io/freesearcheR/
version: 1

View file

@ -94,19 +94,19 @@ server <- function(input, output, session) {
consider.na <- c("NA", "\"\"", "", "\'\'", "na")
data_file <- datamods::import_file_server(
data_file <- import_file_server(
id = "file_import",
show_data_in = "popup",
trigger_return = "change",
return_class = "data.frame",
read_fns = list(
ods = function(file) {
ods = function(file, which, skip, na) {
readODS::read_ods(
path = file,
# Sheet and skip not implemented for .ods in the original implementation
# sheet = sheet,
# skip = skip,
na = consider.na
sheet = which,
skip = skip,
na = na
)
},
dta = function(file) {
@ -115,29 +115,32 @@ server <- function(input, output, session) {
.name_repair = "unique_quiet"
)
},
csv = function(file) {
readr::read_csv(
# csv = function(file) {
# readr::read_csv(
# file = file,
# na = consider.na,
# name_repair = "unique_quiet"
# )
# },
csv = import_delim,
tsv = import_delim,
txt = import_delim,
xls = function(file, which, skip, na) {
openxlsx2::read_xlsx(
file = file,
na = consider.na,
name_repair = "unique_quiet"
sheet = which,
skip_empty_rows = TRUE,
start_row = skip - 1,
na.strings = na
)
},
xls = function(file) {
xlsx = function(file, which, skip, na) {
openxlsx2::read_xlsx(
file = file,
sheet = sheet,
skip_empty_rows = TRUE,
start_row = skip - 1,
na.strings = consider.na
)
},
xlsx = function(file) {
openxlsx2::read_xlsx(
file = file,
sheet = sheet,
skip_empty_rows = TRUE,
start_row = skip - 1,
na.strings = consider.na)
na.strings = na)
},
rds = function(file) {
readr::read_rds(
@ -304,7 +307,7 @@ server <- function(input, output, session) {
shiny::observeEvent(
input$modal_column,
datamods::modal_create_column(id = "modal_column")
datamods::modal_create_column(id = "modal_column",footer = "This is only for advanced users!")
)
data_modal_r <- datamods::create_column_server(
id = "modal_column",

View file

@ -46,9 +46,11 @@ ui_elements <- list(
shiny::br(),
shiny::conditionalPanel(
condition = "input.source=='file'",
datamods::import_file_ui("file_import",
import_file_ui(
id = "file_import",
layout_params = "dropdown",
title = "Choose a datafile to upload",
file_extensions = c(".csv", ".txt", ".xls", ".xlsx", ".rds", ".fst", ".sas7bdat", ".sav", ".ods", ".dta")
file_extensions = c(".csv", ".tsv", ".txt", ".xls", ".xlsx", ".rds", ".sas7bdat", ".ods", ".dta")
)
),
shiny::conditionalPanel(
@ -67,25 +69,27 @@ ui_elements <- list(
shiny::br(),
shiny::h5("Exclude in-complete variables"),
shiny::fluidRow(
shiny::column(width=6,
shiny::br(),
shiny::br(),
shiny::p("Filter incomplete variables, by setting a completeness threshold:"),
shiny::br()
),
shiny::column(width=6,
shinyWidgets::noUiSliderInput(
inputId = "complete_cutoff",
label = NULL,
min = 0,
max = 100,
step = 5,
value = 70,
format = shinyWidgets::wNumbFormat(decimals = 0),
color = datamods:::get_primary_color()
),
shiny::helpText("Include variables with completeness above the specified percentage.")
)
shiny::column(
width = 6,
shiny::br(),
shiny::br(),
shiny::p("Filter incomplete variables, by setting a completeness threshold:"),
shiny::br()
),
shiny::column(
width = 6,
shinyWidgets::noUiSliderInput(
inputId = "complete_cutoff",
label = NULL,
min = 0,
max = 100,
step = 5,
value = 70,
format = shinyWidgets::wNumbFormat(decimals = 0),
color = datamods:::get_primary_color()
),
shiny::helpText("Include variables with completeness above the specified percentage.")
)
),
shiny::br(),
shiny::br(),
@ -167,6 +171,8 @@ ui_elements <- list(
On the right, you can create and modify factor/categorical variables as well as create new variables with *R* code."))
)
),
shiny::tags$br(),
shiny::tags$br(),
fluidRow(
shiny::column(
width = 2