Bắt đầu ngayBắt đầu miễn phí

Storyboards

Hãy chuyển dashboard của bạn thành một storyboard.

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

Xem khóa học

Hướng dẫn bài tập

  • Thay đổi phần đầu để dashboard được trình bày theo định dạng storyboard.

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(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### 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\ntrips_df %>%\n  filter(bike_number == trips_per_bike_df$bike_number[1]) %>%\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"}
Chỉnh sửa và Chạy Mã