Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mod_censored_data.R #197

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions R/mod_censored_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ mod_censored_data_server <- function(id, tadat) {
dat[, c(
"ResultIdentifier",
"TADA.CharacteristicName",
"ResultDetectionConditionText",
"DetectionQuantitationLimitTypeName",
"DetectionQuantitationLimitMeasure.MeasureValue",
"DetectionQuantitationLimitMeasure.MeasureUnitCode",
"TADA.ResultMeasureValue",
Expand All @@ -318,8 +320,11 @@ mod_censored_data_server <- function(id, tadat) {
"Estimated Detection Limit Value" = TADA.ResultMeasureValue,
"Estimated Unit" = TADA.ResultMeasure.MeasureUnitCode
)

# create censored data table
censdat$exdat <-
dat[1:10, ] # just show the first 10 records so user can see what happened to data

shinybusy::remove_modal_spinner(session = shiny::getDefaultReactiveDomain())
tadat$censor_applied <- TRUE

Expand Down Expand Up @@ -359,22 +364,28 @@ mod_censored_data_server <- function(id, tadat) {
shinyjs::enable("od_method")
})

# creates a nice table showing an example of how censored data were changed.
# renders a nice table showing an example of how censored data were changed.
output$see_det <- DT::renderDT({
shiny::req(censdat$exdat)
DT::datatable(
censdat$exdat[1:10, ],
censdat$exdat, #[1:10, ], #cm removed on 12/26/24, limits table to 10 results
class = "cell-border stripe",
filter = "top",
options = list(
dom = "t",
dom = "Blftipr", #"t",#cm updated to match harmonization table on 12/26/24
scrollX = TRUE,
pageLength = 10,
searching = FALSE
pageLength = 10
#searching = FALSE #cm updated to TRUE on 12/26/24
),
selection = "none",
rownames = FALSE
)
})

) %>%
DT::formatStyle(columns = names(censdat$exdat), `font-size` = "12px") %>%
DT::formatStyle(columns = c("Estimated Detection Limit Value", "Estimated Unit"),
backgroundColor = "#2e6da4",
color = "white")
})

# from the clean dataset, get all of the column names someone might want to group by when summarizing their data for use in more advanced censored data methods.
output$cens_groups <- shiny::renderUI({
shiny::req(censdat$dat)
Expand Down
Loading