Skip to content

Commit

Permalink
Merge pull request #27 from MartinLe5/master
Browse files Browse the repository at this point in the history
Update to include CFL; Thanks @MartinLe5 !
  • Loading branch information
beanumber authored Feb 6, 2023
2 parents c6f2e57 + c07ef80 commit 340ebc8
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 44 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Package: teamcolors
Type: Package
Title: Color Palettes for Pro Sports Teams
Version: 0.0.4.9001
Version: 0.0.4.9002
Authors@R: c(
person("Benjamin S.", "Baumer", email = "[email protected]", role = c("aut", "cre")),
person("Gregory J.", "Matthews", email = "[email protected]", role = c("aut")),
person("Luke", "Benz", role = c("ctb")),
person("Arielle", "Dror", role = c("ctb")),
person("Clara", "Rosenberg", role = c("ctb")),
person("Paige", "Patrick", role = c("ctb")),
person("Allan", "Butler", role = c("ctb"))
person("Allan", "Butler", role = c("ctb")),
person("Martin", "Lefebvre", role = c("ctb"))
)
Description: Provides color palettes corresponding to professional and amateur,
sports teams. These can be useful in creating data graphics that are themed
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ output:
# teamcolors <img src='man/figures/logo.png' align="right" height="139" />

<!-- badges: start -->
[![Travis-CI Build Status](https://travis-ci.org/beanumber/teamcolors.svg?branch=master)](https://travis-ci.org/beanumber/teamcolors)
[![CRAN status](https://www.r-pkg.org/badges/version/teamcolors)](https://cran.r-project.org/package=teamcolors)
[![R-CMD-check](https://github.com/beanumber/teamcolors/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/beanumber/teamcolors/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/teamcolors)](https://cran.r-project.org/package=teamcolors)
<!-- badges: end -->


An R package providing color palettes for pro and amateur sports teams. The palettes are provided by [Jim Neilsen's Team Colors website](http://jim-nielsen.com/teamcolors/) and offered with only minimal alterations. NCAA colors come from [teamcolorcodes.com](https://teamcolorcodes.com/), via the [ncaahoopR](https://github.com/lbenz730/ncaahoopR) package.
Other sports include the [Women's National Basketball Association](https://wnba.com), [National Women's Soccer League](https://nwsl.com), and the [Canadian Football League](https://cfl.com).

## Install

Expand Down Expand Up @@ -117,7 +117,7 @@ Links to team logos are provided by (http://www.sportslogos.net/).

```{r logos}
teamcolors %>%
filter(grepl("New ", name)) %>%
filter(grepl("New Y", name)) %>%
pull(logo) %>%
knitr::include_graphics()
```
Expand All @@ -137,7 +137,7 @@ teamcolors %>%

For more examples see:

- Lopez, M.J., Matthews, G.J., Baumer, B.S., "How often does the best team win? A unified approach to understanding randomness in North American sport," *The Annals of Applied Statistics*, vol. 12, no. 4, 2018, pp. 2483--2516. URL (https://projecteuclid.org/euclid.aoas/1542078053)
- Lopez, M.J., Matthews, G.J., Baumer, B.S., "How often does the best team win? A unified approach to understanding randomness in North American sport," *The Annals of Applied Statistics*, vol. 12, no. 4, 2018, pp. 2483--2516. URL (https://doi.org/10.1214/18-AOAS1165)

To cite this package in your work, see:

Expand Down
81 changes: 47 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<!-- badges: start -->

[![Travis-CI Build
Status](https://travis-ci.org/beanumber/teamcolors.svg?branch=master)](https://travis-ci.org/beanumber/teamcolors)
[![R-CMD-check](https://github.com/beanumber/teamcolors/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/beanumber/teamcolors/actions/workflows/R-CMD-check.yaml)
[![CRAN
status](https://www.r-pkg.org/badges/version/teamcolors)](https://cran.r-project.org/package=teamcolors)
<!-- badges: end -->
Expand All @@ -14,7 +13,10 @@ The palettes are provided by [Jim Neilsen’s Team Colors
website](http://jim-nielsen.com/teamcolors/) and offered with only
minimal alterations. NCAA colors come from
[teamcolorcodes.com](https://teamcolorcodes.com/), via the
[ncaahoopR](https://github.com/lbenz730/ncaahoopR) package.
[ncaahoopR](https://github.com/lbenz730/ncaahoopR) package. Other sports
include the [Women’s National Basketball Association](https://wnba.com),
[National Women’s Soccer League](https://nwsl.com), and the [Canadian
Football League](https://cfl.com).

## Install

Expand All @@ -37,16 +39,17 @@ library(teamcolors)
head(teamcolors)
```

## # A tibble: 6 x 11
## name league primary secondary tertiary quaternary division location mascot
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 A&M-… ncaa #0067C5 #007F3E <NA> <NA> Southla… A&M-Cor… Chris…
## 2 Abil… ncaa #461D7C #FFFFFF <NA> <NA> Southla… Abilene Chris…
## 3 AFC … epl #e62333 #000000 <NA> <NA> <NA> AFC Bourn…
## 4 Air … ncaa #003087 #8A8D8F #B1B3B3 #FFC72C MWC Air For… <NA>
## 5 Akro… ncaa #041E42 #A89968 <NA> <NA> MAC Akron Zips
## 6 Alab… ncaa #660000 #FFFFFF <NA> <NA> SWAC Alabama A&M
## # … with 2 more variables: sportslogos_name <chr>, logo <chr>
## # A tibble: 6 × 11
## name league primary secon…¹ terti…² quate…³ divis…⁴ locat…⁵ mascot sport…⁶
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 A&M-Cor… ncaa #0067C5 #007F3E <NA> <NA> Southl… A&M-Co… Chris… A&M-Co…
## 2 AFC Bou… epl #e62333 #000000 <NA> <NA> <NA> AFC Bourn… AFC Bo…
## 3 Abilene… ncaa #461D7C #FFFFFF <NA> <NA> WAC Abilene Chris… Abilen…
## 4 Air For… ncaa #003087 #8A8D8F #B1B3B3 #FFC72C MWC Air Fo… <NA> Air Fo…
## 5 Akron ncaa #041E42 #A89968 <NA> <NA> MAC Akron <NA> Akron
## 6 Alabama ncaa #9E1B32 #828A8F #FFFFFF <NA> SEC Alabama <NA> Alabama
## # … with 1 more variable: logo <chr>, and abbreviated variable names
## # ¹​secondary, ²​tertiary, ³​quaternary, ⁴​division, ⁵​location, ⁶​sportslogos_name

## Show palettes

Expand Down Expand Up @@ -119,6 +122,13 @@ ggplot(pythag, aes(x = wpct, y = exp_wpct, color = name, fill = name)) +
coord_equal()
```

## Warning: The `guide` argument in `scale_*()` cannot be `FALSE`. This was deprecated in
## ggplot2 3.3.4.
## ℹ Please use "none" instead.

## Warning: ggrepel: 4 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

![](README_files/figure-gfm/ggplot-1.png)<!-- -->

### Base R
Expand Down Expand Up @@ -150,6 +160,11 @@ palettes for non-NCAA teams.
show_team_col()
```

## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the teamcolors package.
## Please report the issue at <]8;;https://github.com/beanumber/teamcolors/issueshttps://github.com/beanumber/teamcolors/issues]8;;>.

![](README_files/figure-gfm/teamcolors-1.png)<!-- -->

To view color palettes for college teams, use the `show_ncaa_col()`
Expand All @@ -167,12 +182,12 @@ Links to team logos are provided by (<http://www.sportslogos.net/>).

``` r
teamcolors %>%
filter(grepl("New ", name)) %>%
filter(grepl("New Y", name)) %>%
pull(logo) %>%
knitr::include_graphics()
```

![](https://content.sportslogos.net/logos/7/151/thumbs/y71myf8mlwlk8lbgagh3fd5e0.gif)<!-- -->![](https://content.sportslogos.net/logos/9/327/thumbs/32748292009.gif)<!-- -->![](https://content.sportslogos.net/logos/33/768/thumbs/2864.gif)<!-- -->![](https://content.sportslogos.net/logos/1/18/thumbs/32tfs723a3bes0p0hb4hgcy1u.gif)<!-- -->![](https://content.sportslogos.net/logos/33/769/thumbs/ghyb25tvzhogmpe3beytq4wtg.gif)<!-- -->![](https://content.sportslogos.net/logos/33/770/thumbs/77055192007.gif)<!-- -->![](https://content.sportslogos.net/logos/6/4962/thumbs/496226812014.gif)<!-- -->![](https://content.sportslogos.net/logos/33/771/thumbs/77148682013.gif)<!-- -->![](https://content.sportslogos.net/logos/7/175/thumbs/907.gif)<!-- -->![](https://content.sportslogos.net/logos/9/5119/thumbs/511960002015.gif)<!-- -->![](https://content.sportslogos.net/logos/7/166/thumbs/919.gif)<!-- -->![](https://content.sportslogos.net/logos/1/19/thumbs/1939112018.gif)<!-- -->![](https://content.sportslogos.net/logos/7/152/thumbs/15291162019.gif)<!-- -->![](https://content.sportslogos.net/logos/6/216/thumbs/2nn48xofg0hms8k326cqdmuis.gif)<!-- -->![](https://content.sportslogos.net/logos/16/309/thumbs/30978362020.gif)<!-- -->![](https://content.sportslogos.net/logos/54/67/thumbs/m01gfgeorgvbfw15fy04alujm.gif)<!-- -->![](https://content.sportslogos.net/logos/1/20/thumbs/144.gif)<!-- -->![](https://content.sportslogos.net/logos/9/1876/thumbs/i9ni847kriagxdlb7xewa6dl8.gif)<!-- -->![](https://content.sportslogos.net/logos/53/68/thumbs/1256.gif)<!-- -->
![](https://content.sportslogos.net/logos/9/5119/thumbs/511960002015.gif)<!-- -->![](https://content.sportslogos.net/logos/7/166/thumbs/919.gif)<!-- -->![](https://content.sportslogos.net/logos/1/19/thumbs/1939112018.gif)<!-- -->![](https://content.sportslogos.net/logos/7/152/thumbs/15291162019.gif)<!-- -->![](https://content.sportslogos.net/logos/6/216/thumbs/2nn48xofg0hms8k326cqdmuis.gif)<!-- -->![](https://content.sportslogos.net/logos/16/309/thumbs/30978362020.gif)<!-- -->![](https://content.sportslogos.net/logos/54/67/thumbs/m01gfgeorgvbfw15fy04alujm.gif)<!-- -->![](https://content.sportslogos.net/logos/1/20/thumbs/144.gif)<!-- -->![](https://content.sportslogos.net/logos/9/1876/thumbs/i9ni847kriagxdlb7xewa6dl8.gif)<!-- -->![](https://content.sportslogos.net/logos/53/68/thumbs/1256.gif)<!-- -->

Note that we don’t have any coverage for the EPL.

Expand All @@ -185,30 +200,28 @@ teamcolors %>%
)
```

## `summarise()` ungrouping output (override with `.groups` argument)

## # A tibble: 9 x 3
## league num_teams num_logos
## <chr> <int> <int>
## 1 epl 20 0
## 2 mlb 30 30
## 3 mls 22 22
## 4 nba 30 30
## 5 ncaa 353 301
## 6 nfl 32 31
## 7 nhl 31 31
## 8 nwsl 9 8
## 9 wnba 12 12
## # A tibble: 10 × 3
## league num_teams num_logos
## <chr> <int> <int>
## 1 cfl 9 8
## 2 epl 20 0
## 3 mlb 30 30
## 4 mls 22 21
## 5 nba 30 30
## 6 ncaa 363 235
## 7 nfl 32 31
## 8 nhl 31 31
## 9 nwsl 9 7
## 10 wnba 12 12

## References

For more examples see:

- Lopez, M.J., Matthews, G.J., Baumer, B.S., “How often does the best
team win? A unified approach to understanding randomness in North
American sport,” *The Annals of Applied Statistics*, vol. 12, no. 4,
2018, pp. 2483–2516. URL
(<https://projecteuclid.org/euclid.aoas/1542078053>)
- Lopez, M.J., Matthews, G.J., Baumer, B.S., “How often does the best
team win? A unified approach to understanding randomness in North
American sport,” *The Annals of Applied Statistics*, vol. 12, no. 4,
2018, pp. 2483–2516. URL (<https://doi.org/10.1214/18-AOAS1165>)

To cite this package in your work, see:

Expand Down
Binary file modified README_files/figure-gfm/base-r-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/ggplot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/ncaacolors-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/show_col-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/teamcolors-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions data-csv/teamcolors_cfl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name,league,primary,secondary,tertiary,quaternary,division,location,mascot,sportslogos_name,logo
BC Lions,cfl,#F15623,#000000,#FFFFFF,NA,West,Vancouver,Leo the Lion,BC Lions,https://content.sportslogos.net/logos/8/91/thumbs/9188272016.gif
Calgary Stampeders,cfl,#CC202C,#FFFFFF,#000000,NA,West,Calgary,Ralph the Dog,Calgary Stampeders,https://content.sportslogos.net/logos/8/92/thumbs/9266442019.gif
Edmonton Elks,cfl,#2B5134,#FFB819,#FFFFFF,NA,West,Edmonton,Nanook and Punter,Edmonton Football Team,https://content.sportslogos.net/logos/8/6790/thumbs/679051822021.gif
Saskatchewan Roughriders,cfl,#006241,#FFFFFF,NA,NA,West,Regina,Gainer the Gopher,Saskatchewan Roughriders,https://content.sportslogos.net/logos/8/98/thumbs/9862612016.gif
Winnipeg Blue Bombers,cfl,#BA9459,#FFFFFF,NA,NA,West,Winnipeg,Buzz and Boomer,Winnipeg Blue Bombers,https://content.sportslogos.net/logos/8/100/thumbs/10025172012.gif
Hamilton Tiger-Cats,cfl,#000000,#FFB819,#FFFFFF,NA,East,Hamilton,Pigskin Pete,Hamilton Tiger-Cats,https://content.sportslogos.net/logos/8/94/thumbs/6242.gif
Toronto Argonauts,cfl,#5F8DB5,#0A2240,NA,NA,East,Toronto,Jason,Toronto Argonauts,https://content.sportslogos.net/logos/8/99/thumbs/9948162021.gif
Ottawa Redblacks,cfl,#AC1F2D,#000000,#FFFFFF,NA,East,Ottawa,Big Joe,Ottawa Redblacks,https://content.sportslogos.net/logos/8/5033/thumbs/503398272014.gif
Montreal Alouettes,cfl,#D70F27,#FFFFFF,NA,NA,East,Montreal,Touche,Montral Alouettes,https://content.sportslogos.net/logos/8/95/thumbs/9557782019.gif
2 changes: 1 addition & 1 deletion data-csv/teamcolors_ncaa.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name,league,primary,secondary,tertiary,quaternary,division
A&M-Corpus Christi,ncaa,#0067C5,#007F3E,NA,NA,Southland
Abilene Christian,ncaa,#461D7C,#FFFFFF,NA,NA,WAC
Abilene Christian Wildcats,ncaa,#461D7C,#FFFFFF,NA,NA,WAC
Air Force,ncaa,#003087,#8A8D8F,#B1B3B3,#FFC72C,MWC
Akron,ncaa,#041E42,#A89968,NA,NA,MAC
Alabama,ncaa,#9E1B32,#828A8F,#FFFFFF,NA,SEC
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions data-raw/50_merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@ teamcolors <- teamcolors %>%
division = ifelse(name %in% c('Colorado Rapids', 'FC Dallas', 'Houston Dynamo', 'LA Galaxy', 'Los Angeles FC', 'Minnesota United FC', 'Portland Timbers', 'Real Salt Lake', 'San Jose Earthquakes', 'Seattle Sounders FC', 'Sporting Kansas City', 'Vancouver Whitecaps FC'), "Western Conference", division)
)

## WNBA
## WNBA, NWSL, and CFL

teamcolors_wnba <- read_csv("data-csv/teamcolors_wnba.csv") %>%
select(name, league, primary, secondary,tertiary, quaternary, division)

teamcolors_nwsl <- read_csv(here::here("data-csv", "teamcolors_nwsl.csv"))

teamcolors_cfl <- read_csv(here::here("data-csv", "teamcolors_cfl.csv")) |>
select(name, league, primary, secondary,tertiary, quaternary, division)

teamcolors <- teamcolors %>%
bind_rows(
teamcolors_wnba,
teamcolors_nwsl
teamcolors_nwsl,
teamcolors_cfl
) %>%
arrange(name) %>%
as_tibble()
Expand Down
3 changes: 2 additions & 1 deletion data-raw/99_logos.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ leagues <- tribble(
"http://www.sportslogos.net/teams/list_by_league/34/NCAA_Division_I_s-t/NCAA_s-t/logos/", "//*[@id='team']",
"http://www.sportslogos.net/teams/list_by_league/35/NCAA_Division_I_u-z/NCAA_u-z/logos/", "//*[@id='team']",
"http://www.sportslogos.net/teams/list_by_league/202/National_Womens_Soccer_League/NWSL/logos/", "//*[@id='team']",
"http://www.sportslogos.net/teams/list_by_league/16/Womens_National_Basketball_Association/WNBA/logos/", "//*[@id='team']",
"http://www.sportslogos.net/teams/list_by_league/16/Womens_National_Basketball_Association/WNBA/logos/", "//*[@id='team']",
"http://www.sportslogos.net/teams/list_by_league/8/Canadian_Football_League/CFL/logos/", "//*[@id='team']",
)


Expand Down
Binary file modified data/teamcolors.rda
Binary file not shown.

0 comments on commit 340ebc8

Please sign in to comment.