library(tidyverse)
library(palmerpenguins)
library(DT)
library(plotly)
library(flexdashboard)
library(leaflet)22-interactivity
Plotly 1
Load the palmerpenguins data set and create a scatterplot of body_mass_g vs. flipper_length_mm from the penguins data set. Use color and shape to specify the species.
Once you have a static graphic you’re happy with, load plotly and convert it to an interactive graphic.
- What tooltips are included by default?
- Change the default tooltip to include “Species”
- (If time) use stringr so that the tooltip shows: “Species: Adelie” instead of just “Adelie”
Plotly 2
Create a bar chart of species from the penguins data set, then convert it to an interactive bar chart.
- What tools tips are included by default?
- What would you change?
Leaflet
- Find the names of the 3 islands in
penguins - Find appropriate lat/long locations for each of the islands in
penguinsusing the internet - Create a leaflet map with markers for each island (Tip: Start with the world map with no zoom)
- Include a popup with the island name
DT Table
- Create a {DT} table of the penguins dataset
- Add the option to filter, and make the font size 14pt
Putting it all together
Open up the 22-dashboard-example-qmd file and make a dashboard that combines all of the interactive plots/tables you made:
- Make sure all graphs are plotly’s/leaflets with appropriate tooltips
- Place your {DT} data table in the data section
In addition:
- Add value boxes above your map that show the number of penguins that live on each island. It may help to check out the source code for the NZ earthquake dashboard when figuring out how to layout the page dashboard with these value boxes.
- Change the theme of the dashboard