character in "numeric input" widget

I created a numeric input widget, but I need to put numbers AND letters in this field.

Example:
ID: 23433EA6

UI Code:

      numericInput(inputId= "diametro", label= "Diametro do Aco:", value= 0),
      
      numericInput(inputId= "parede", label= "Parede:", value= 0),
      
      numericInput(inputId= "grau", label= "Grau:", value= 0),
      
      numericInput(inputId= "aqa", label= "AQA:", value= 0),

SERVER Code:

 data.frame(
    Name = c("Diametro",
             "Parede",
             "Grau",
             "AQA",
             ),
    Values = as.character(c(input$diametro,
                             input$parede,
                             input$grau,
                             input$aqa,
                             )),

It works that way? Just putting "AS.CHARACTER" in front of input values?

Thanks!

If you need numbers AND letters, you should use textInput instead of numericInput.

I'm not sure what you want to accomplish in your server code, but as.character will just convert the arguments to strings. So if you input the number 123 in the "diametro" numericInput then input$diametro will be 123, and as.character will make it into "123". If you input 23433EA6 in the "diametro" numericInput then input$diametro will be NA, and as.character will make it into NA. Not what you want, I guess.

2 Likes

It makes sense. I just don't think that way before.

I'll try it... for sure it will works.

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