BaşlayınÜcretsiz Başlayın

Add a leaflet map directly from dataframe

Now let's make the same map more easily by passing the dataframe directly to leaflet().

Bu egzersiz

Building Dashboards with flexdashboard

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the stations_df dataframe to add a leaflet map marking station locations to the Stations Map chart - but don't use the column names directly.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

{"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(leaflet)\n\nstations_df <- read_csv('https://assets.datacamp.com/production/course_6355/datasets/stations_data.csv')\n```\n\n\n\nColumn {data-width=650}\n-----------------------------------------------------------------------\n\n### Stations Map\n\n```{r}\nleaflet() %>%\n  addTiles() %>%\n  addMarkers(lat = stations_df$latitude, lng = stations_df$longitude)\n```\n\n\n"}
Kodu Düzenle ve Çalıştır