CommencerCommencer gratuitement

Formatted text

Shiny has many functions that can transform plain text into formatted text. Simply place text inside the h1() function to create a primary header (e.g. a title), h2() for a secondary header, strong() to make text bold, em() to make text italicized, or any of the other formatting functions.

You can also intermingle plain text and formatted text as much as you'd like—just remember to separate all the elements with commas!

Cet exercice fait partie du cours

Case Studies: Building Web Applications with Shiny in R

Afficher le cours

Instructions

Place the following text inside the Shiny app:

  • The word "DataCamp" as a primary header.
  • The words "Shiny use cases course" as a secondary header.
  • The word "Shiny" in italics.
  • The words "is fun" as bold text.

After completing the instructions, your Shiny app should render the following text:

DataCamp

Shiny use cases course

Shiny is fun

Exercice interactif pratique

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

# Load the shiny package
library(shiny)

# Define UI for the application
ui <- fluidPage(
  # "DataCamp" as a primary header
  ___,
  # "Shiny use cases course" as a secondary header
  ___,
  # "Shiny" in italics
  ___,
  # "is fun" as bold text
  ___
)

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

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