R Language Shiny Launch a Shiny app


Example

You can launch an application in several ways, depending on how you create you app. If your app is divided in two files ui.R and server.R or if all of your app is in one file.

1. Two files app

Your two files ui.R and server.Rhave to be in the same folder. You could then launch your app by running in the console the shinyApp() function and by passing the path of the directory that contains the Shiny app.

shinyApp("path_to_the_folder_containing_the_files")  

You can also launch the app directly from Rstudio by pressing the Run App button that appear on Rstudio when you an ui.R or server.R file open.
ClicktoRun

Or you can simply write runApp() on the console if your working directory is Shiny App directory.

2. One file app

If you create your in one R file you can also launch it with the shinyApp() function.

  • inside of your code :
library(shiny)

ui <- fluidPage() #Create the ui
server <- function(input, output){} #create the server

shinyApp(ui = ui, server = server) #run the App
  • in the console by adding path to a .R file containing the Shiny application with the paramter appFile:
shinyApp(appFile="path_to_my_R_file_containig_the_app")