The www directory
The www
directory is the directory expected by a Shiny application to locally store the elements that will be rendered in the web browser and are not the output of the scripts. This includes images, HTML, .js
files, and so on. This directory must be at the same level as UI.R
and server.R
, that is, on the application's main folder.
Back to the first example, if we would like to include an image of the R logo that is stored as Rlogo.jpg
before the number input, the code will be as follows in UI.R
:
library(shiny) # Starting line shinyUI(fluidPage( # Application title titlePanel("Example 1"), # Sidebar with a numeric input # Sidebar sidebarLayout( sidebarPanel( img(src="Rlogo.jpg"), numericInput("number", "Insert a number:", value = 30, min = 1, max = 50)), #The plot created in server.R is displayed mainPanel( plotOutput("plot") ) ) ))
This folder is the destination of the files generated in the following sections...