Get startedGet started for free

Captions with Inline Code

Now let's add some inline R code to our caption.

This exercise is part of the course

Building Dashboards with flexdashboard

View Course

Exercise instructions

  • Modify the caption to read "Source: Bay Area Bike Share, Date: ", where the date the data represents appears at the end. (use the variable data_date).

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

{"my_document.Rmd":"---\ntitle: \"Bike Shares Daily\"\noutput: \n  flexdashboard::flex_dashboard:\n    orientation: columns\n    vertical_layout: fill\n---\n\n```{r setup, include=FALSE}\nlibrary(flexdashboard)\nlibrary(readr)\nlibrary(leaflet)\nlibrary(DT)\nlibrary(tidyverse)\nlibrary(lubridate)\n\ntrips_df <- read_csv('https://assets.datacamp.com/production/repositories/1448/datasets/1f12031000b09ad096880bceb61f6ca2fd95e2eb/sanfran_bikeshare_joined_oneday.csv')\n\ndata_date <- unique(as.Date(trips_df$start_date))\n```\n\nColumn \n-----------------------------------------------------------------------\n### Origins\n\n```{r}\n\ntrips_df %>%\n  rename(latitude = start_latitude,\n         longitude = start_longitude) %>%\n  group_by(start_station_id, latitude, longitude) %>%\n  count() %>%\n  leaflet() %>%\n  addTiles() %>%\n  addCircles(radius = ~n)\n\n```\n\n> Source: Bay Area Bike Share\n\n\n"}
Edit and Run Code