我的代码:-
library(shiny)
ui <- fluidPage(
titlePanel("Find square of x"),
numericInput("x","x:",5),
uiOutput("y")
)
server <- function(input, output){
output$y <- renderUI({
numericInput("y","Square of x:",input$x * input$x)
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
在此应用程序中,用户可以更改输出的值"Square of x"。有什么方法可以防止这种情况(意味着可以在输出中禁用用户输入)。
或者,如果用户修改输出"Square of x"而不是输入,"x"也会相应地发生变化。