This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-21 14:22:36 +01:00
commit ae1c120cd8
No known key found for this signature in database
4 changed files with 30 additions and 16 deletions

View file

@ -5,6 +5,6 @@ account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 11351429
bundleId: 9392352
bundleId: 9396834
url: https://agdamsbo.shinyapps.io/redcapcast/
version: 1

View file

@ -17,21 +17,23 @@ server <- function(input, output, session) {
file = NULL
)
dat <- shiny::reactive({
ds <- shiny::reactive({
shiny::req(input$ds)
out <- read_input(input$ds$datapath)
# Saves labels to reapply later
# labels <- lapply(out, get_attr)
out <- out |>
## Parses data with readr functions
parse_data() |>
## Converts logical to factor, which overwrites attributes
##
## Converts logical to factor, preserving attributes with own function
dplyr::mutate(dplyr::across(dplyr::where(is.logical), as_factor))
out
})
dat <- shiny::reactive({
out <- ds()
if (!is.null(input$factor_vars)) {
out <- out |>
dplyr::mutate(
@ -42,12 +44,6 @@ server <- function(input, output, session) {
)
}
# Old attributes are appended
# out <- purrr::imap(out,\(.x,.i){
# set_attr(.x,labels[[.i]])
# }) |>
# dplyr::bind_cols()
out
})