Color indicators
Let's imagine the bike share company has a goal to have two thirds of their trips under 10 minutes to maximize bike availability. We can indicate their success based on the gauge color.
Questo esercizio fa parte del corso
Building Dashboards with flexdashboard
Istruzioni dell'esercizio
- Add sectors to the "% Short Trips" gauge where 67 and up is success, 32 and below is danger, and warning is in between.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
{"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\n### % Short Trips\n\n```{r}\n\nnum_trips <- nrow(trips_df)\nshort_trips <- sum(trips_df$duration_sec < 600) # under 10 min\npct_short_trips <- round(100 * short_trips / num_trips, 0)\n\ngauge(value = pct_short_trips,\n min = 0,\n max = 100)\n\n```\n\n### Trips by Start Time\n\n\n"}