Thanks for the added information. I didnt include any code because the question I had was more general, but now that I read over it I think an example could definitely help. Below you will find the function that I wish to place in the body of the shiny application source code, rather than within the server function. For further context, I have also included components in the UI and Server code to which it relies on. I hope this is an apt Reprex:
Code causing issues within the server function:
generate_values <- function(trunk,num) {
list <- vector("numeric", num)
for (i in seq_len(num)) {
list[i] <- input[[(paste0(trunk, i))]]
}
list
}
Context code in the server:
output$input_panel <- renderUI({
fluidRow(lapply(1:input$std_concentration, function(iter1){
column(2, numericInput(paste0("std_conc", iter1), paste0("Concentration ", iter1), value = 1))
}))
})
#server function 006 - render the summary page based on the inputs for trt_groups variable
output$input_panel2 <- renderUI({
fluidRow(lapply(1:input$trt_groups, function(iter1){
column(2, textInput(paste0("trt_grp", iter1), paste0("Group ", iter1), value = 1))
}))
})
#server action 007 - render the summary page based on the inputs for the trt_treatment variable
output$input_panel3 <- renderUI({
fluidRow(lapply(1:input$trt_treatments, function(iter1){
column(2, textInput(paste0("trt_trt", iter1), paste0("Treatment ", iter1), value = 1))
}))
})
Context code in the UI:
tabPanel("Summary",
uiOutput("input_panel"),
uiOutput("input_panel2"),
uiOutput("input_panel3")),
The question I have is in regard to the function generate_values(). There are no problems with it currently, but I would like to move it to the top of the document with the rest of my functions. I would like to know if there is a way to have a function which evaluates input variables outside of the server scope, so that the server function is merely calling the function generate_values() and does not need to house its definition also.
Thank you in advanced,
Chris