Unwanted formatting of scientific notation as character to numeric in SliderTextInput

Hello! newbie to shiny.

I want to give a number of simulations input. I want the possible values to be displayed as "1e2, 1e3,...,1e6" but the SliderTextInput converts the scientific notation, altough entered as characters to numeric. Is there any way to force shiny to display "1e2" as "1e2" (which then later can be used as numeric in the server) and not 100?

if (interactive()) {
    ui <- fluidPage(
            inputId = "n_sim_binary",
            label = "Number of simulations. NB Log Scale",
            choices = as.character(c("a", "1e2", "c")),
            selected = as.character("a"),
            grid = T)    
    server <- function(input, output, session) {
    shinyApp(ui = ui, server = server)

Hmm... strange.

You can use some HTML in the choices. You can do

choices = c("a", "<span>1e2</span>", "c")

and this works as desired.

Thank you, this does give the desired UI
altough input$n_sim_binary will now be the string


which makes acces to the numeric value complicated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.