Global Crop Yields

Interactive Shiny Dashboard

Published

August 31, 2020

Notable topics: Interactive Shiny Dashboard

Recorded on: 2020-08-31

Timestamps by: Eric Fletcher

View code

Screencast

Timestamps

rename
dplyr

Using rename to shorten column name

rename_allstr_remove
dplyrstring

Using rename_all with str_remove and regex to remove characters in column name

pivot_longer
tidyr

Using pivot_longer to change data from wide to long

geom_linefacet_wrap
ggplot2

Create a faceted geom_line chart

fct_reorder
forcats

Using fct_reorder to reorder facet panels in ascending order

write_rdsinputPanelrenderPlot
shinydplyrggplot2forcatsstringrplotly

Create an interactive Shiny dashboard

geom_line
ggplot2

Create a faceted geom_line chart with add_count and filter(n = max(x)) to subset the data for crops that have observations in every year

geom_pointgeom_abline
ggplot2

Create a faceted geom_point chart showing the crop yields at start and end over a 50 year period (1968 start date and 2018 end date)

geom_boxplot
ggplot2

Create a geom_boxplot to visualize the distribution of yield ratios for the different crops to see how efficiency has increased across countries

geom_col
ggplot2

Create a geom_col chart to visualize the median yield ratio for each crop

geom_pointgeom_text_repel
ggplot2ggrepel

Create a geom_point chart to visualize efficiency imporvement for each country for a specific crop (yield start / yield ratio)

countrycodegeom_hlinegeom_text_repel
countrycodeggplot2ggrepel

Using the countrycode package to color geom_point chart by continent names

Summary of screencast