The following code should update button to opt2 every time q is pressed in the keyboard:
library(shiny)
fun <- "$(function(){ 
      $(document).keyup(function(e) {
      if (e.which == 81) {
        $('#button_2').prop('checked',true)
      }
      });
      })"
runApp(shinyApp(
  ui = fluidPage(
    tags$script(HTML(fun)),
    radioButtons("button", "A radio button", choices = list("opt1" = 1, "opt2" = 2)),
    textOutput("text")),
  server=function(input, output, session) {
    output$text <- renderText({input$button})
  }
))
The problem is that I don't know how Shiny stores the radio button internally. I'm trying to reference the second option of button as button_2, but it is clearly not working. Also, I'm not sure if the JQuery solution (proposed here) is the most appropriate one.
 
     
    
