shiny Getting started with shiny Simple App


Each shiny app contains two parts: A user interface definition (UI) and a server script (server). This example shows how you can print "Hello world" from UI or from server.


In the UI you can place some view objects (div, inputs, buttons, etc).


# Define UI for application print "Hello world" 

  # Create bootstrap page 
    # Paragraph "Hello world"
    p("Hello world"),

    # Create button to print "Hello world" from server
    actionButton(inputId = "Print_Hello", label = "Print_Hello World"),

    # Create position for server side text


In the server script you can define methods which manipulate data or listen to actions.

# Define server logic required to print "Hello World" when button is clicked
shinyServer(function(input, output) {
  # Create action when actionButton is clicked

    # Change text of Server_Hello
    output$Server_Hello = renderText("Hello world from server side")

How to run?

You can run your app in several ways:

  1. Create two different files and place them into one directory, then use runApp('your dir path')
  2. You can define two variables (ui and server, for example) and then use shinyApp(ui,server) to run your app


In this example you will see some text and a button:

screenshot before click

And after button click the server responds:

screenshot after click