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

Chú thích với mã nội tuyến

Bây giờ hãy thêm một chút mã R nội tuyến vào chú thích.

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

  • Sửa chú thích để hiển thị "Source: Bay Area Bike Share, Date: ", trong đó ngày mà dữ liệu đại diện xuất hiện ở cuối. (dùng biến data_date).

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)\n\ntrips_df <- read_csv('https://assets.datacamp.com/production/repositories/1448/datasets/1f12031000b09ad096880bceb61f6ca2fd95e2eb/sanfran_bikeshare_joined_oneday.csv')\n\ndata_date <- unique(as.Date(trips_df$start_date))\n```\n\nColumn \n-----------------------------------------------------------------------\n### Origins\n\n```{r}\n\ntrips_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  addCircles(radius = ~n)\n\n```\n\n> Source: Bay Area Bike Share\n\n\n"}
Chỉnh sửa và Chạy Mã