I don't know what is the purpose but yes you can use rlang functions if you wish to. You just need to pass correct type in the function.
-
input[[test]] won't work because test does not exist. I think you mean input[['test']] or input$test
-
rlang::parse_expr will return an expression, not something that can be rendered as text by renderText. See help page
- I think you need as least to eval the expression, using for example
rlang::eval_tidy.
Try
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
textInput("test", "TEST")
),
mainPanel(
verbatimTextOutput("debug")
)
)
)
server <- function(input, output) {
output$debug <- renderText({
rlang::eval_tidy(rlang::parse_expr("input[['test']]"))
})
}
shinyApp(ui = ui, server = server)
Let's note the this is a dummy example as passing input$test directly here will work fine.
Hope it helps you dig and understand rlang.