knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(star.rank)
library(ggplot2)

Package Overview

The star.rank package is intended to provide a simplified method to create plots from the data contained on the SWAPI API. The functions found in this package allow the user to specify which category of Star Wars elements they would like to explore, as well as which method they would like the results sorted by. For most functions there is also an argument to specify the number of records on the plot.

Function Demos

The use of each function is very straightforward, simply requiring specification of which metric to rank the output on, and an optional argument for the number of values on the returned plot.

rank_films

rank_films(interested = "vehicles")

rank_films(interested = "starships")

rank_people

rank_people(interested = "height")

rank_people(interested = "mass", n = 10)

rank_planets

rank_planets(interested = "diameter")

rank_planets(interested = "population", n = 60)

rank_species

rank_species(interested = "average_height")

rank_species(interested = "average_height", n = 20)

rank_starships

rank_starships(interested = "crew")

rank_starships(interested = "max_atmosphering_speed", n = 10)

rank_vehicles

rank_vehicles(interested = "passengers")

rank_vehicles(interested = "cargo_capacity", n = 5)

Additional ggplot Features

It is even possible to add to the plots just as you would any ggplot.

rank_vehicles(interested = "cargo_capacity", n = 5) +
  labs(title = "Top 5 Star Wars Vehicles by Cargo Capacity")

rank_people(interested = "mass") +
  geom_bar(stat = "identity", fill = "purple")


The0therChad/star.rank documentation built on March 27, 2022, 4:24 p.m.