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

DT::datatable

Bây giờ hãy tùy chỉnh bảng của bạ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

Xem khóa học

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

  • Loại bỏ cột số thứ tự hàng và thêm các nút vào bảng từ bài tập trước.

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)\nlibrary(plotly)\nlibrary(knitr)\nlibrary(DT)\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### Station Usage\n\n```{r}\n\nstation_trips_df <- trips_df %>%\n  select(start_station_name, end_station_name) %>%\n  pivot_longer(cols = start_station_name:end_station_name, names_to = 'Type', values_to = 'Station') %>%\n  group_by(Station, Type) %>%\n  summarize(n_trips = n()) %>% \n  mutate(Type = ifelse(Type == 'start_station_name', 'Trip Starts', 'Trip Ends')) %>%\n  pivot_wider(names_from = 'Type', values_from = 'n_trips') %>%\n  replace_na(list(`Trip Starts` = 0, `Trip Ends` = 0)) %>%\n  mutate(Gap = `Trip Ends` - `Trip Starts`)\n\ndatatable(station_trips_df)\n\n```\n\n\nColumn {data-width=350}\n-----------------------------------------------------------------------\n\n### Median Trip Length\n\n\n### % Short Trips\n\n\n### Trips by Start Time\n\n\n"}
Chỉnh sửa và Chạy Mã