Thanks for your response. But adding options(digits = 2) seems not affecting the input value of the numericInput.
Please see the following R script as an example. When running it as a Shiny app, I would like to see the numericInput "C"'s value as rounded such as 0.67, but the actual value is still 0.66666....
library(shiny)
# Define UI
ui <- fluidPage(
numericInput(inputId = "A", "Number A", value = 2),
numericInput(inputId = "B", "Number B", value = 3),
numericInput(inputId = "C", "Number C [A/B]", value = 1)
)
# Server logic
server <- function(input, output, session){
observe({
req(input$A, input$B)
num_C <- input$A/input$B
updateNumericInput(
inputId = "C",
session = session,
value = num_C
)
})
}
# Complete app with UI and server components
shinyApp(ui, server)