Lời bình cho storyboard
Hãy thêm lời bình cho phần thứ hai của câu chuyện.
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
- Chuyển hai gạch đầu dòng văn bản trước biểu đồ đầu tiên thành lời bình cho phần thứ hai của câu chuyện.
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 storyboard: true\n---\n\n```{r setup, include=FALSE}\nlibrary(flexdashboard)\nlibrary(readr)\nlibrary(leaflet)\nlibrary(DT)\nlibrary(tidyverse)\nlibrary(lubridate)\nlibrary(plotly)\n\ntrips_df <- read_csv('https://assets.datacamp.com/production/repositories/1448/datasets/1f12031000b09ad096880bceb61f6ca2fd95e2eb/sanfran_bikeshare_joined_oneday.csv')\n```\n\n* Bike `r most_used_bike_df$bike_number[1]` made its first trip from `r most_used_bike_df$start_station_name[1]` and ended its day at `r most_used_bike_df$end_station_name[nrow(most_used_bike_df)]`.\n* Its longest trip was `r max(most_used_bike_df$duration_sec)/60` minutes long.\n\n### Most bikes are used only a few times, but a few are used a lot\n\n```{r}\n\ntrips_per_bike_df <- trips_df %>%\n group_by(bike_number) %>%\n summarize(n_trips = n()) %>%\n arrange(desc(n_trips)) \n\nbike_plot <- trips_per_bike_df %>%\n ggplot(aes(x = n_trips)) +\n geom_histogram(binwidth = 1) +\n ylab('') +\n xlab('Trips per bike') \n\nggplotly(bike_plot)\n\n```\n\n### Where did the most used bike go?\n\n```{r}\n\nmost_used_bike_df <- trips_df %>%\n filter(bike_number == trips_per_bike_df$bike_number[1])\n\nmost_used_bike_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 addMarkers()\n\n```\n\n\n"}