| Title: | Relational Data from the 'Star Wars' API for Learning and Teaching |
|---|---|
| Description: | Provides data about the 'Star Wars' movie franchise in a set of relational tables or as a complete 'DuckDB' database. All data was collected from the open source 'Star Wars' API. |
| Authors: | Garrick Aden-Buie [aut, cre] (ORCID: <https://orcid.org/0000-0002-7111-0077>) |
| Maintainer: | Garrick Aden-Buie <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.3.9000 |
| Built: | 2026-05-25 06:16:45 UTC |
| Source: | https://github.com/gadenbuie/starwarsdb |
Films in the Star Wars movie franchise.
filmsfilms
A data frame with 6 rows and 6 variables:
titleThe title of this film.
episode_idThe episode number of this film.
opening_crawlThe opening crawl text at the beginning of this film.
directorThe director of this film.
producerhe producer(s) of this film.
release_dateThe release date at original creator country.
The Star Wars API (SWAPI).
Links characters (people) to the films in which they appear.
films_peoplefilms_people
A data frame with 162 rows and 2 variables:
titleThe title of the film.
characterThe name of the character who appeared in the film.
The Star Wars API (SWAPI).
Links planets to the films in which they appear.
films_planetsfilms_planets
A data frame with 33 rows and 2 variables:
titleThe title of the film.
planetThe name of the planet that appeared in the film.
The Star Wars API (SWAPI).
Links vehicles to the films in which they appear
films_vehiclesfilms_vehicles
A data frame with 104 rows and 2 variables:
titleThe title of the film.
vehicleThe name of the vehicle that appeared in the film.
The Star Wars API (SWAPI).
Characters within the Star Wars universe.
peoplepeople
A data frame with 82 rows and 10 variables:
nameThe name of this person.
heightThe height of this person in meters.
massThe mass of this person in kilograms.
hair_colorThe hair color of this person.
skin_colorThe skin color of this person.
eye_colorThe eye color of this person.
birth_yearThe birth year of this person. BBY (Before the Battle of Yavin) or ABY (After the Battle of Yavin).
sexThe biological sex of the character. One of male, female, hermaphroditic, or none.
genderThe gender role or gender identity of the character.
homeworldThe planet the character was born on.
speciesThe species of the character.
The Star Wars API (SWAPI).
Links people to the vehicles they have piloted.
pilotspilots
A data frame with 43 rows and 2 variables:
pilotThe name of the person who piloted the vehicle.
vehicleThe name of the vehicle that was piloted.
The Star Wars API (SWAPI).
Planets in the Star Wars universe.
planetsplanets
A data frame with 59 rows and 9 variables:
nameThe name of this planet.
rotation_periodThe number of standard hours it takes for this planet to complete a single rotation on its axis.
orbital_periodThe number of standard days it takes for this planet to complete a single orbit of its local star.
diameterThe diameter of this planet in kilometers.
climateThe climate of this planet. Comma-seperated if diverse.
gravityA number denoting the gravity of this planet. Where 1 is normal.
terrainThe terrain of this planet. Comma-seperated if diverse.
surface_waterThe percentage of the planet surface that is naturally occurring water or bodies of water.
populationThe average population of sentient beings inhabiting this planet.
The Star Wars API (SWAPI).
Includes information about the schema of the tables that were sourced from
SWAPI, the Star Wars API. Not all properties returned from the API are
columns in the data in this package: some properties were refactored into
separate tables. For example, I combined the starships/ and vehicles/
endpoint into a single table. Both API endpoints returned a "pilots"
property, which is described in the schema as an array of people who piloted
the vehicle. The information in this property has been extracted into a
separate table called pilots in the starwarsdb package.
schemaschema
A data frame with 5 rows and 4 variables:
endpointThe name of the SWAPI endpoint.
endpoint_titleThe title of the SWAPI endpoint.
endpoint_descriptionThe description of the SWAPI endpoint.
propertiesThe properties of the endpoint as a nested table containing the variable, the data type, a description and the format of the property.
The Star Wars API (SWAPI).
Species within the Star Wars universe.
speciesspecies
A data frame with 37 rows and 10 variables:
nameThe name of this species.
classificationThe classification of this species.
designationThe designation of this species.
average_heightThe average height of this person in centimeters.
skin_colorsA comma-seperated string of common skin colors for this species, none if this species does not typically have skin.
hair_colorsA comma-seperated string of common hair colors for this species, none if this species does not typically have hair.
eye_colorsA comma-seperated string of common eye colors for this species, none if this species does not typically have eyes.
average_lifespanThe average lifespan of this species in years.
homeworldThe URL of a planet resource, a planet that this species originates from.
languageThe language commonly spoken by this species.
The Star Wars API (SWAPI).
Provides a connection to a DuckDB database of the Star Wars data.
Alternatively, you can use starwars_db() to manually connect to the
database using DBI::dbConnect() and duckdb::duckdb().
starwars_connect(dbdir = ":memory:", ...) starwars_disconnect(con) starwars_db()starwars_connect(dbdir = ":memory:", ...) starwars_disconnect(con) starwars_db()
dbdir |
Location for database files. Should be a path to an existing
directory in the file system. With the default (or |
... |
Additional parameters passed to |
con |
A connection to the Star Wars database |
A connection to the Star Wars database, or the path to the database.
starwars_connect(): Connect to the DuckDB database
starwars_disconnect(): Disconnect from the DuckDB database
starwars_db(): Returns the path to the starwarsdb database
# Manually connect using {duckdb} and {DBI} con <- DBI::dbConnect( duckdb::duckdb(), dbdir = starwars_db(), read_only = TRUE ) if (requireNamespace("dplyr", quietly = TRUE)) { dplyr::tbl(con, "films") } # Disconnect from that database (shutdown is specific to duckdb) DBI::dbDisconnect(con, shutdown = TRUE) # Or connect without worrying about connection details con <- starwars_connect() if (requireNamespace("dplyr", quietly = TRUE)) { dplyr::tbl(con, "films") } # Similarly, disconnect quickly without worrying about duckdb arguments starwars_disconnect(con)# Manually connect using {duckdb} and {DBI} con <- DBI::dbConnect( duckdb::duckdb(), dbdir = starwars_db(), read_only = TRUE ) if (requireNamespace("dplyr", quietly = TRUE)) { dplyr::tbl(con, "films") } # Disconnect from that database (shutdown is specific to duckdb) DBI::dbDisconnect(con, shutdown = TRUE) # Or connect without worrying about connection details con <- starwars_connect() if (requireNamespace("dplyr", quietly = TRUE)) { dplyr::tbl(con, "films") } # Similarly, disconnect quickly without worrying about duckdb arguments starwars_disconnect(con)
Creates a dm object with the starwarsdb tables.
starwars_dm(configure_dm = TRUE, remote = FALSE) starwars_dm_configure(dm)starwars_dm(configure_dm = TRUE, remote = FALSE) starwars_dm_configure(dm)
configure_dm |
If |
remote |
If |
dm |
A dm object with the starwarsdb tables |
A dm object
starwars_dm_configure(): Configure the starwars dm object with primary
and foreign keys and colors.
dm::dm(), dm::dm_add_pk(), dm::dm_add_fk(), dm::dm_from_src()
# If the {dm} package is installed... if (requireNamespace("dm", quietly = TRUE)) { # Create a full starwars {dm} object from local tables starwars_dm(remote = TRUE) # Create a base starwars {dm} object from remote tables wihout keys starwars_dm(configure_dm = FALSE, remote = TRUE) }# If the {dm} package is installed... if (requireNamespace("dm", quietly = TRUE)) { # Create a full starwars {dm} object from local tables starwars_dm(remote = TRUE) # Create a base starwars {dm} object from remote tables wihout keys starwars_dm(configure_dm = FALSE, remote = TRUE) }
A Starship or vehicle in the Star Wars universe.
vehiclesvehicles
A data frame with 75 rows and 14 variables:
nameThe name of this vehicle. The common name, such as Sand Crawler.
typeThe type of the vehicle: starship or vehicle.
classThe class of the vehicle, source from starship_class or vehicle_class.
modelThe model or official name of this vehicle. Such as All Terrain Attack Transport.
manufacturerThe manufacturer of this vehicle. Comma seperated if more than one.
cost_in_creditsThe cost of this vehicle new, in galactic credits.
lengthThe length of this vehicle in meters.
max_atmosphering_speedThe maximum speed of this vehicle in atmosphere.
crewThe number of personnel needed to run or pilot this vehicle.
passengersThe number of non-essential people this vehicle can transport.
cargo_capacityThe maximum number of kilograms that this vehicle can transport.
consumablesThe maximum length of time that this vehicle can provide consumables for its entire crew without having to resupply.
hyperdrive_ratingThe class of this starships hyperdrive.
MGLTThe Maximum number of Megalights this starship can travel in a standard hour. A Megalight is a standard unit of distance and has never been defined before within the Star Wars universe. This figure is only really useful for measuring the difference in speed of starships. We can assume it is similar to AU, the distance between our Sun (Sol) and Earth.
The Star Wars API (SWAPI).