European Energy
Data manipulation, Country flags, Slope graph, Function creation
Notable topics: Data manipulation, Country flags, Slope graph, Function creation
Recorded on: 2020-08-03
Timestamps by: Eric Fletcher
Screencast
Timestamps
Using count
to get an overview of scategorical data
Using pivot_longer
and gather
to pivot date variables from wide to long
Using as.integer
to change year
variable from character
to integer
class
Using fct_reorder
to reorder stacked barplot
Using scale_y_continuous
with labels = comma
from scales
package to insert a comma every three digits on the y-axis
Using replace_na
and list
to replace NA
values in country_name
column with United Kingdom
Using fct_lump
to lump factor levels together except for the 10 most frequent for each facet panel
Using reorder_within
with fun = sum
and scale_y_reordered
to reorder the categories within each facet panel
Using ggflags
package to add country flags | Debugging strategies include 1) minimal reproducible example and 2) binary search
(Unsuccessfully) Using fct_recode
to rename the ISO two-digit identifier for the United Kingdom from the UK to GB
Using ifelse
to replace the ISO two-digit identifier for the United Kingdom from UK to GB & from EL to GR fro Greece | Debugging included
Using str_to_lower
to convert observations in country
column to lower case
Creating a slope graph
to show differences in Nuclear production (2106 versus 2018) | Using scale_y_log10
to increase distance between points | Using ggflags
for country flags
Using scale_x_continuous
with breaks = c(2016, 2018)
to show only 2016 and 2018 on x-axis
Extend x-axis limits using scale_x_continuous
with limits = c(2015, 2019)
and geom_text
with an ifelse
within hjust
to alternate labels for the right and left side of slope graph
Creating a slopegraph function
Summary of screencast