Code Monkey home page Code Monkey logo

carnaval's Introduction

carnaval

Lifecycle: experimental

Carnaval is the biggest street feast of Brazil. It happens all over the country in a kaleidoscope of sound and color. One of its many shapes is the yearly competition between Samba Schools in Rio.

The carnaval package provides easy access to both datasets on the competition and color palettes inspired by the carioca Samba Schools. The package focuses on the main league of the competition (“Grupo Especial”).

Currently, all data comes from the Galeria do Samba portal. If you like this package, please help them keeping their project afloat: Contribua.

The package is under development and has these functions:

  • get_scores: Obtain scores of samba schools by year, school and/or criterion. Data goes back since 1968;

  • get_remarks: Obtain remarks on the evaluation process. Data goes back since 1968;

  • get_parades: Obtain total scores (and more) of samba schools by year and/or school. Data goes back since 1932;

  • display_all: Plots the available Samba School palettes;

  • scale_ARG_rio_TYPE: Family of ggplot functions for plotting with Samba School palettes. Can be used to fill or color/colour (ARG) and for discrete (d) or continuous (c) scales (TYPE);

  • colorblind_friendly: Indicates whether a palette is friendly towards some types of colorblindness.

Script that builds the palettes is inspired by the MetBrewer package. Colorblindness performance was checked using colorblindcheck.

Installation and loading

Install carnaval from GitHub as follows:

if (!require(devtools)) install.packages("devtools")
devtools::install_github("IcaroBernardes/carnaval")

Examples

# Loads the package
library(carnaval)

# Prints a table that shows the scores of Portela and
# Estácio de Sá on the parades of 1968 and 1970 on all criterions
get_scores(years = c(1968, 1970), schools = c("portela", "Estácio de Sá"))
#> # A tibble: 52 × 6
#>    school         year score criteria                 judge_name         judge…¹
#>    <chr>         <dbl> <dbl> <chr>                    <chr>              <glue> 
#>  1 Estácio de Sá  1968     6 ALEGORIAS E ADEREÇOS     Napoleão Muniz Fr… judge1 
#>  2 Portela        1968    10 ALEGORIAS E ADEREÇOS     Napoleão Muniz Fr… judge1 
#>  3 Estácio de Sá  1968     7 BATERIA                  João de Barros  B… judge1 
#>  4 Portela        1968     9 BATERIA                  João de Barros  B… judge1 
#>  5 Estácio de Sá  1968     7 COMISSÃO DE FRENTE       Danúbio Menezes G… judge1 
#>  6 Portela        1968     9 COMISSÃO DE FRENTE       Danúbio Menezes G… judge1 
#>  7 Estácio de Sá  1968     4 CONJUNTO                 Ítalo de Oliveira  judge1 
#>  8 Portela        1968     4 CONJUNTO                 Ítalo de Oliveira  judge1 
#>  9 Estácio de Sá  1968     4 DESFILE NÃO INTERROMPIDO Maurício Shermann  judge1 
#> 10 Estácio de Sá  1968     2 DESFILE NÃO INTERROMPIDO Sandra Dicken      judge2 
#> # … with 42 more rows, and abbreviated variable name ¹​judge_number
# Loads ggplot2
library(ggplot2)

# Gets the scores of Império Serrano from 1968 until 2018 on the Bateria criterion.
# Throws some warnings to inform the user which years are absent of the data
# (either from missing info or because the school didn't compete in the main league)
df <- get_scores(years = 1968:2018, schools = "Império Serrano", criterions = "BATERIA")

# Creates a plot and applies manually the palette of Império Serrano
ggplot(data = df, aes(x = judge_number, y = score, fill = judge_number)) +
  geom_violin() +
  scale_fill_manual(values = rio_paletter("Imperio_Serrano", 5))

Palettes

Beija Flor de Nilópolis



  • Friendly towards deuteranopia and protanopia

Acadêmicos do Grande Rio



  • Friendly towards protanopia and tritanopia

Imperatriz Leopoldinense



  • Friendly towards deuteranopia and tritanopia

Império Serrano



  • Friendly towards deuteranopia, protanopia and tritanopia

Estação Primeira de Mangueira



  • Friendly towards deuteranopia, protanopia and tritanopia

Mocidade Independente de Padre Miguel



  • Friendly towards deuteranopia and tritanopia

Paraíso do Tuiuti



  • Friendly towards deuteranopia, protanopia and tritanopia

Portela



  • Friendly towards deuteranopia, protanopia and tritanopia

Acadêmicos do Salgueiro



  • Friendly towards deuteranopia, protanopia and tritanopia

São Clemente



  • Friendly towards deuteranopia, protanopia and tritanopia

Unidos da Tijuca



  • Friendly towards deuteranopia, protanopia and tritanopia

União da Ilha do Governador



  • Friendly towards deuteranopia, protanopia and tritanopia

Unidos de Vila Isabel



  • Friendly towards deuteranopia

Unidos do Viradouro



  • Friendly towards deuteranopia, protanopia and tritanopia

Credits

This package was created by Ícaro Bernardes.

The hex logo was created by Bruno Mioto. Bruno also gave many tips that made building the package easier.

carnaval's People

Contributors

icarobernardes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

carnaval's Issues

Cores escolas de samba RJ

Em construção

Império Serrano #008001 #ffffff #ffce03
Acadêmicos do Grande Rio (Duque de Caxias) #e12225 #008540 #fefefe
Mocidade Independente de Padre Miguel #008f40 #dbca01 #f6f6f6 (cores aproximadas)
Unidos da Tijuca
Acadêmicos do Salgueiro
Estação Primeira de Mangueira
Paraíso do Tuiuti
Portela
Unidos de Vila Isabel
Imperatriz Leopoldinense
Beija-Flor (Nilópolis)
Unidos do Viradouro (Niterói)

Release carnaval 0.1.1

First release:

Prepare for release:

  • git pull
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • usethis::use_news_md()
  • git push

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.