CommencerCommencer gratuitement

Simple text

Every Shiny app has a UI (User Interface) portion and a server portion. The UI is where the visual elements are placed—it controls the layout and appearance of your app. The server is where the logic of the app is implemented—for example, where calculations are performed and plots are generated.

An empty UI is created using the fluidPage() function. Adding text to a Shiny app is done by adding text inside fluidPage() as an argument. In fact, the entire UI is built by supplying the fluidPage() function with as many arguments as you want.

Cet exercice fait partie du cours

Case Studies: Building Web Applications with Shiny in R

Afficher le cours

Instructions

Create a Shiny app that displays the text "Shiny is fun" by following these specific instructions:

  • Load the shiny package.
  • Create the UI for the Shiny app using the fluidPage() function.
  • Add the text "Shiny is fun" to the UI.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Load the shiny package
___

# Define UI for the application
ui <- ___(
  # Add the text "Shiny is fun"
  ___
)

# Define the server logic
server <- function(input, output) {}

# Run the application
shinyApp(ui = ui, server = server)
Modifier et exécuter le code