medal_counts2: Medal Counts for Winter Olympics by Country A dataset...

medal_counts2R Documentation

Medal Counts for Winter Olympics by Country A dataset containing the medals and places won by each country, assuming the country has won at least 1 total medal

Description

Medal Counts for Winter Olympics by Country

A dataset containing the medals and places won by each country, assuming the country has won at least 1 total medal

Usage

medal_counts2

Format

A data frame with 117 rows and 3 variables:

Country

name of country, as referred to by the USA

Medal

type of medal, factor with levels "gold", "silver" or "bronze"

totals

number of medals of that type, in counts

Examples

utils::data(medal_counts2)

medal_counts2 |>
dplyr::mutate(Medal = forcats::fct_relevel(Medal,'bronze','silver','gold'),
      Country = reorder(Country, totals, sum)) |>
 plotly::plot_ly() |>
 plotly::add_bars(x = ~Country, y = ~totals, color = ~Medal,
 colors = c("#CD7F32", "#C0C0C0", "#FFD700")) |>
 plotly::layout(hovermode = "x") |>
 plotly::layout(title = "Norway Has the Most Gold,
 Silver, <br> and Bronze Winter Olympic
 Medals <br> (1924 - 2014)") |>
 plotly::layout(
   yaxis = list(title = "Total Medals"),
   xaxis = list(rangeslider = list(type = "date")),
   updatemenus = list(list(type = "buttons", direction = "right", x = 0.9, y = 0.98,
                           buttons = list(
                             list(method = "relayout", args = list("barmode", "group"),
                                  label = "Dodge"),
                             list(method = "relayout", args = list("barmode", "stack"),
                                  label = "Stack")
                           ))))

sadleskorn/apply303 documentation built on April 14, 2022, 11:57 a.m.