Create value box
Let's create a value box to show average trip duration for bike share.
This exercise is part of the course
Building Dashboards with flexdashboard
Exercise instructions
- In the Median Trip Length chart, add a value box to display
median_min
(median trip section). - Set the caption to describe the value as
"Median Trip Duration (Minutes)"
. - Add an icon of a clock using
"fa-clock-o"
from the Font Awesome library.
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(tidyverse)\nlibrary(lubridate)\n\ntrips_df <- read_csv('https://assets.datacamp.com/production/course_6355/datasets/sanfran_bikeshare_joined_oneday.csv')\n```\n\nColumn {data-width=650}\n-----------------------------------------------------------------------\n\n### Origins\n\n\nColumn {data-width=350}\n-----------------------------------------------------------------------\n\n### Median Trip Length\n\n```{r}\n\nmedian_min <- median(trips_df$duration_sec / 60) %>% round(digits = 1)\n\n___(___,\n caption = \"___\",\n icon = \"___\")\n```\n\n### % Short Trips\n\n\n### Trips by Start Time\n\n\n"}