Tạo value box
Hãy tạo một value box để hiển thị thời lượng chuyến đi trung bình cho dịch vụ chia sẻ xe đạp.
Bài tập này là một phần của khóa học
Xây dựng Dashboard với flexdashboard
Hướng dẫn bài tập
- Trong biểu đồ Median Trip Length, thêm một value box để hiển thị
median_min(phần median trip). - Đặt chú thích để mô tả giá trị là
"Median Trip Duration (Minutes)". - Thêm biểu tượng đồng hồ bằng
"fa-clock-o"từ thư viện Font Awesome.
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
{"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"}