Hi,
I want to use an interactive app to show the output of some experimental logistic regression in in shiny. I thought the best way to do this is to use the checkboxGroupInput to select which independent factors to use in the regression model. However, I am a bit flummoxed by how best to extract the choices into a string that would then feed into the model. Ultimately, the output would be someway of displaying the odds ratio etc of each factor. To illustrate:
# The input
checkboxGroupInput("fct_choice", label = "Independent Factors",
choices = list("ASA" = "ASA",
"Frailty" = "Frailty",
"Surgical Approach" = "Sx_Approach",
"Acute Kidney Injury" = "AKI")
)
Ideally, the user of the app can select any combination of the choices above. I thought something like a paste
function with reactive
might be used, but I am struggling to work out how to put this together when not all the choices are ticked.
For example, the below only works when all the factors are ticked (I am using renderText just to see what I would get).
output$value <- renderText({
value_factors <- input$fct_choice
list_factors <- paste(value_factors[[1]], value_factors[[2]], value_factors[[3]], value_factors[[4]], sep = "+" )
print(list_factors)
})
I would appreciate any suggestions, I thought maybe this can be solved with purr
but I am not familiar with this.