diff --git a/NEWS.md b/NEWS.md
index f750364100..dcbb5d1960 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,8 @@
# dplyr (development version)
+* Updated the `starwars` data to use a new API, because the old one is defunct.
+ There are very minor changes to the data itself (#6938, @steveharoz).
+
# dplyr 1.1.3
* `mutate_each()` and `summarise_each()` now throw correct deprecation messages
diff --git a/R/data-starwars.R b/R/data-starwars.R
index 8286fd29c2..f826cf1d56 100644
--- a/R/data-starwars.R
+++ b/R/data-starwars.R
@@ -1,6 +1,6 @@
#' Starwars characters
#'
-#' The original data, from SWAPI, the Star Wars API, , has been revised
+#' The original data, from SWAPI, the Star Wars API, , has been revised
#' to reflect additional research into gender and sex determinations of characters.
#'
#' @format A tibble with 87 rows and 14 variables:
diff --git a/data-raw/starwars.R b/data-raw/starwars.R
index 1c8032c613..bd76c94704 100644
--- a/data-raw/starwars.R
+++ b/data-raw/starwars.R
@@ -17,7 +17,7 @@ get_all <- function(url) {
out
}
-people <- get_all("http://swapi.co/api/people")
+people <- get_all("https://swapi.py4e.com/api/people/?format=json")
str(people[[1]])
@@ -33,15 +33,15 @@ lookup <- function(url, name = "name") {
set_names(name, url)
}
-species <- lookup("http://swapi.co/api/species")
-films <- lookup("http://swapi.co/api/films", "title")
-planets <- lookup("http://swapi.co/api/planets")
-vehicles <- lookup("http://swapi.co/api/vehicles")
-starships <- lookup("http://swapi.co/api/starships")
+species <- lookup("https://swapi.py4e.com/api/species/?format=json")
+films <- lookup("https://swapi.py4e.com/api/films/?format=json", "title")
+planets <- lookup("https://swapi.py4e.com/api/planets/?format=json")
+vehicles <- lookup("https://swapi.py4e.com/api/vehicles/?format=json")
+starships <- lookup("https://swapi.py4e.com/api/starships/?format=json")
starwars <- tibble(
name = people %>% map_chr("name"),
- height = people %>% map_chr("height") %>% parse_integer(na = "unknown"),
+ height = people %>% map_chr("height") %>% parse_integer(na = c("unknown", "none")),
mass = people %>% map_chr("mass") %>% parse_number(na = "unknown"),
hair_color = people %>% map_chr("hair_color") %>% parse_character(na = "n/a"),
skin_color = people %>% map_chr("skin_color"),
@@ -94,6 +94,12 @@ starwars %>% filter(is.na(sex)) %>% select(name, species, gender, sex)
starwars %>% count(gender, sort = TRUE)
starwars %>% count(sex, gender, sort = TRUE)
+# Fix a typo --------------------------------------------------------------
+
+# see https://github.com/tidyverse/dplyr/pull/6840
+starwars = starwars %>%
+ mutate(name = ifelse(name == "Beru Whitesun lars", "Beru Whitesun Lars", name))
+
# Basic checks -------------------------------------------------------------
starwars %>% count(species, sort = TRUE)
diff --git a/data-raw/starwars.csv b/data-raw/starwars.csv
index 41f86ce99f..afffcc41cd 100644
--- a/data-raw/starwars.csv
+++ b/data-raw/starwars.csv
@@ -1,25 +1,25 @@
name,height,mass,hair_color,skin_color,eye_color,birth_year,sex,gender,homeworld,species,films,vehicles,starships
-Luke Skywalker,172,77,blond,fair,blue,19,male,masculine,Tatooine,Human,"The Empire Strikes Back, Revenge of the Sith, Return of the Jedi, A New Hope, The Force Awakens","Snowspeeder, Imperial Speeder Bike","X-wing, Imperial shuttle"
-C-3PO,167,75,NA,gold,yellow,112,none,masculine,Tatooine,Droid,"The Empire Strikes Back, Attack of the Clones, The Phantom Menace, Revenge of the Sith, Return of the Jedi, A New Hope",,
-R2-D2,96,32,NA,"white, blue",red,33,none,masculine,Naboo,Droid,"The Empire Strikes Back, Attack of the Clones, The Phantom Menace, Revenge of the Sith, Return of the Jedi, A New Hope, The Force Awakens",,
-Darth Vader,202,136,none,white,yellow,41.9,male,masculine,Tatooine,Human,"The Empire Strikes Back, Revenge of the Sith, Return of the Jedi, A New Hope",,TIE Advanced x1
-Leia Organa,150,49,brown,light,brown,19,female,feminine,Alderaan,Human,"The Empire Strikes Back, Revenge of the Sith, Return of the Jedi, A New Hope, The Force Awakens",Imperial Speeder Bike,
-Owen Lars,178,120,"brown, grey",light,blue,52,male,masculine,Tatooine,Human,"Attack of the Clones, Revenge of the Sith, A New Hope",,
-Beru Whitesun lars,165,75,brown,light,blue,47,female,feminine,Tatooine,Human,"Attack of the Clones, Revenge of the Sith, A New Hope",,
+Luke Skywalker,172,77,blond,fair,blue,19,male,masculine,Tatooine,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi, Revenge of the Sith, The Force Awakens","Snowspeeder, Imperial Speeder Bike","X-wing, Imperial shuttle"
+C-3PO,167,75,NA,gold,yellow,112,none,masculine,Tatooine,Droid,"A New Hope, The Empire Strikes Back, Return of the Jedi, The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+R2-D2,96,32,NA,"white, blue",red,33,none,masculine,Naboo,Droid,"A New Hope, The Empire Strikes Back, Return of the Jedi, The Phantom Menace, Attack of the Clones, Revenge of the Sith, The Force Awakens",,
+Darth Vader,202,136,none,white,yellow,41.9,male,masculine,Tatooine,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi, Revenge of the Sith",,TIE Advanced x1
+Leia Organa,150,49,brown,light,brown,19,female,feminine,Alderaan,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi, Revenge of the Sith, The Force Awakens",Imperial Speeder Bike,
+Owen Lars,178,120,"brown, grey",light,blue,52,male,masculine,Tatooine,Human,"A New Hope, Attack of the Clones, Revenge of the Sith",,
+Beru Whitesun Lars,165,75,brown,light,blue,47,female,feminine,Tatooine,Human,"A New Hope, Attack of the Clones, Revenge of the Sith",,
R5-D4,97,32,NA,"white, red",red,NA,none,masculine,Tatooine,Droid,A New Hope,,
Biggs Darklighter,183,84,black,light,brown,24,male,masculine,Tatooine,Human,A New Hope,,X-wing
-Obi-Wan Kenobi,182,77,"auburn, white",fair,blue-gray,57,male,masculine,Stewjon,Human,"The Empire Strikes Back, Attack of the Clones, The Phantom Menace, Revenge of the Sith, Return of the Jedi, A New Hope",Tribubble bongo,"Jedi starfighter, Trade Federation cruiser, Naboo star skiff, Jedi Interceptor, Belbullab-22 starfighter"
-Anakin Skywalker,188,84,blond,fair,blue,41.9,male,masculine,Tatooine,Human,"Attack of the Clones, The Phantom Menace, Revenge of the Sith","Zephyr-G swoop bike, XJ-6 airspeeder","Trade Federation cruiser, Jedi Interceptor, Naboo fighter"
-Wilhuff Tarkin,180,NA,"auburn, grey",fair,blue,64,male,masculine,Eriadu,Human,"Revenge of the Sith, A New Hope",,
-Chewbacca,228,112,brown,unknown,blue,200,male,masculine,Kashyyyk,Wookiee,"The Empire Strikes Back, Revenge of the Sith, Return of the Jedi, A New Hope, The Force Awakens",AT-ST,"Millennium Falcon, Imperial shuttle"
-Han Solo,180,80,brown,fair,brown,29,male,masculine,Corellia,Human,"The Empire Strikes Back, Return of the Jedi, A New Hope, The Force Awakens",,"Millennium Falcon, Imperial shuttle"
+Obi-Wan Kenobi,182,77,"auburn, white",fair,blue-gray,57,male,masculine,Stewjon,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi, The Phantom Menace, Attack of the Clones, Revenge of the Sith",Tribubble bongo,"Jedi starfighter, Trade Federation cruiser, Naboo star skiff, Jedi Interceptor, Belbullab-22 starfighter"
+Anakin Skywalker,188,84,blond,fair,blue,41.9,male,masculine,Tatooine,Human,"The Phantom Menace, Attack of the Clones, Revenge of the Sith","Zephyr-G swoop bike, XJ-6 airspeeder","Naboo fighter, Trade Federation cruiser, Jedi Interceptor"
+Wilhuff Tarkin,180,NA,"auburn, grey",fair,blue,64,male,masculine,Eriadu,Human,"A New Hope, Revenge of the Sith",,
+Chewbacca,228,112,brown,unknown,blue,200,male,masculine,Kashyyyk,Wookiee,"A New Hope, The Empire Strikes Back, Return of the Jedi, Revenge of the Sith, The Force Awakens",AT-ST,"Millennium Falcon, Imperial shuttle"
+Han Solo,180,80,brown,fair,brown,29,male,masculine,Corellia,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi, The Force Awakens",,"Millennium Falcon, Imperial shuttle"
Greedo,173,74,NA,green,black,44,male,masculine,Rodia,Rodian,A New Hope,,
-Jabba Desilijic Tiure,175,1358,NA,"green-tan, brown",orange,600,hermaphroditic,masculine,Nal Hutta,Hutt,"The Phantom Menace, Return of the Jedi, A New Hope",,
-Wedge Antilles,170,77,brown,fair,hazel,21,male,masculine,Corellia,Human,"The Empire Strikes Back, Return of the Jedi, A New Hope",Snowspeeder,X-wing
-Jek Tono Porkins,180,110,brown,fair,blue,NA,male,masculine,Bestine IV,Human,A New Hope,,X-wing
-Yoda,66,17,white,green,brown,896,male,masculine,NA,Yoda's species,"The Empire Strikes Back, Attack of the Clones, The Phantom Menace, Revenge of the Sith, Return of the Jedi",,
-Palpatine,170,75,grey,pale,yellow,82,male,masculine,Naboo,Human,"The Empire Strikes Back, Attack of the Clones, The Phantom Menace, Revenge of the Sith, Return of the Jedi",,
-Boba Fett,183,78.2,black,fair,brown,31.5,male,masculine,Kamino,Human,"The Empire Strikes Back, Attack of the Clones, Return of the Jedi",,Slave 1
+Jabba Desilijic Tiure,175,1358,NA,"green-tan, brown",orange,600,hermaphroditic,masculine,Nal Hutta,Hutt,"A New Hope, Return of the Jedi, The Phantom Menace",,
+Wedge Antilles,170,77,brown,fair,hazel,21,male,masculine,Corellia,Human,"A New Hope, The Empire Strikes Back, Return of the Jedi",Snowspeeder,X-wing
+Jek Tono Porkins,180,110,brown,fair,blue,NA,NA,NA,Bestine IV,NA,A New Hope,,X-wing
+Yoda,66,17,white,green,brown,896,male,masculine,NA,Yoda's species,"The Empire Strikes Back, Return of the Jedi, The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+Palpatine,170,75,grey,pale,yellow,82,male,masculine,Naboo,Human,"The Empire Strikes Back, Return of the Jedi, The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+Boba Fett,183,78.2,black,fair,brown,31.5,male,masculine,Kamino,Human,"The Empire Strikes Back, Return of the Jedi, Attack of the Clones",,Slave 1
IG-88,200,140,none,metal,red,15,none,masculine,NA,Droid,The Empire Strikes Back,,
Bossk,190,113,none,green,red,53,male,masculine,Trandosha,Trandoshan,The Empire Strikes Back,,
Lando Calrissian,177,79,black,dark,brown,31,male,masculine,Socorro,Human,"The Empire Strikes Back, Return of the Jedi",,Millennium Falcon
@@ -30,33 +30,35 @@ Arvel Crynyd,NA,NA,brown,fair,brown,NA,male,masculine,NA,Human,Return of the Jed
Wicket Systri Warrick,88,20,brown,brown,brown,8,male,masculine,Endor,Ewok,Return of the Jedi,,
Nien Nunb,160,68,none,grey,black,NA,male,masculine,Sullust,Sullustan,Return of the Jedi,,Millennium Falcon
Qui-Gon Jinn,193,89,brown,fair,blue,92,male,masculine,NA,Human,The Phantom Menace,Tribubble bongo,
-Nute Gunray,191,90,none,mottled green,red,NA,male,masculine,Cato Neimoidia,Neimodian,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,
+Nute Gunray,191,90,none,mottled green,red,NA,male,masculine,Cato Neimoidia,Neimodian,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
Finis Valorum,170,NA,blond,fair,blue,91,male,masculine,Coruscant,Human,The Phantom Menace,,
-Jar Jar Binks,196,66,none,orange,orange,52,male,masculine,Naboo,Gungan,"Attack of the Clones, The Phantom Menace",,
+Padmé Amidala,185,45,brown,light,brown,46,female,feminine,Naboo,Human,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,"Naboo fighter, H-type Nubian yacht, Naboo star skiff"
+Jar Jar Binks,196,66,none,orange,orange,52,male,masculine,Naboo,Gungan,"The Phantom Menace, Attack of the Clones",,
Roos Tarpals,224,82,none,grey,orange,NA,male,masculine,Naboo,Gungan,The Phantom Menace,,
Rugor Nass,206,NA,none,green,orange,NA,male,masculine,Naboo,Gungan,The Phantom Menace,,
-Ric Olié,183,NA,brown,fair,blue,NA,NA,NA,Naboo,NA,The Phantom Menace,,Naboo Royal Starship
-Watto,137,NA,black,"blue, grey",yellow,NA,male,masculine,Toydaria,Toydarian,"Attack of the Clones, The Phantom Menace",,
+Ric Olié,183,NA,brown,fair,blue,NA,male,masculine,Naboo,Human,The Phantom Menace,,Naboo Royal Starship
+Watto,137,NA,black,"blue, grey",yellow,NA,male,masculine,Toydaria,Toydarian,"The Phantom Menace, Attack of the Clones",,
Sebulba,112,40,none,"grey, red",orange,NA,male,masculine,Malastare,Dug,The Phantom Menace,,
-Quarsh Panaka,183,NA,black,dark,brown,62,NA,NA,Naboo,NA,The Phantom Menace,,
-Shmi Skywalker,163,NA,black,fair,brown,72,female,feminine,Tatooine,Human,"Attack of the Clones, The Phantom Menace",,
+Quarsh Panaka,183,NA,black,dark,brown,62,male,masculine,Naboo,Human,The Phantom Menace,,
+Shmi Skywalker,163,NA,black,fair,brown,72,female,feminine,Tatooine,Human,"The Phantom Menace, Attack of the Clones",,
Darth Maul,175,80,none,red,yellow,54,male,masculine,Dathomir,Zabrak,The Phantom Menace,Sith speeder,Scimitar
Bib Fortuna,180,NA,none,pale,pink,NA,male,masculine,Ryloth,Twi'lek,Return of the Jedi,,
-Ayla Secura,178,55,none,blue,hazel,48,female,feminine,Ryloth,Twi'lek,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,
+Ayla Secura,178,55,none,blue,hazel,48,female,feminine,Ryloth,Twi'lek,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+Ratts Tyerel,79,15,none,"grey, blue",unknown,NA,male,masculine,Aleen Minor,Aleena,The Phantom Menace,,
Dud Bolt,94,45,none,"blue, grey",yellow,NA,male,masculine,Vulpter,Vulptereen,The Phantom Menace,,
Gasgano,122,NA,none,"white, blue",black,NA,male,masculine,Troiken,Xexto,The Phantom Menace,,
Ben Quadinaros,163,65,none,"grey, green, yellow",orange,NA,male,masculine,Tund,Toong,The Phantom Menace,,
-Mace Windu,188,84,none,dark,brown,72,male,masculine,Haruun Kal,Human,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,
-Ki-Adi-Mundi,198,82,white,pale,yellow,92,male,masculine,Cerea,Cerean,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,
-Kit Fisto,196,87,none,green,black,NA,male,masculine,Glee Anselm,Nautolan,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,
+Mace Windu,188,84,none,dark,brown,72,male,masculine,Haruun Kal,Human,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+Ki-Adi-Mundi,198,82,white,pale,yellow,92,male,masculine,Cerea,Cerean,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
+Kit Fisto,196,87,none,green,black,NA,male,masculine,Glee Anselm,Nautolan,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,
Eeth Koth,171,NA,black,brown,brown,NA,male,masculine,Iridonia,Zabrak,"The Phantom Menace, Revenge of the Sith",,
Adi Gallia,184,50,none,dark,blue,NA,female,feminine,Coruscant,Tholothian,"The Phantom Menace, Revenge of the Sith",,
Saesee Tiin,188,NA,none,pale,orange,NA,male,masculine,Iktotch,Iktotchi,"The Phantom Menace, Revenge of the Sith",,
Yarael Poof,264,NA,none,white,yellow,NA,male,masculine,Quermia,Quermian,The Phantom Menace,,
-Plo Koon,188,80,none,orange,black,22,male,masculine,Dorin,Kel Dor,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,Jedi starfighter
-Mas Amedda,196,NA,none,blue,blue,NA,male,masculine,Champala,Chagrian,"Attack of the Clones, The Phantom Menace",,
-Gregar Typho,185,85,black,dark,brown,NA,male,masculine,Naboo,Human,Attack of the Clones,,Naboo fighter
-Cordé,157,NA,brown,light,brown,NA,female,feminine,Naboo,Human,Attack of the Clones,,
+Plo Koon,188,80,none,orange,black,22,male,masculine,Dorin,Kel Dor,"The Phantom Menace, Attack of the Clones, Revenge of the Sith",,Jedi starfighter
+Mas Amedda,196,NA,none,blue,blue,NA,male,masculine,Champala,Chagrian,"The Phantom Menace, Attack of the Clones",,
+Gregar Typho,185,85,black,dark,brown,NA,NA,NA,Naboo,NA,Attack of the Clones,,Naboo fighter
+Cordé,157,NA,brown,light,brown,NA,NA,NA,Naboo,NA,Attack of the Clones,,
Cliegg Lars,183,NA,brown,fair,blue,82,male,masculine,Tatooine,Human,Attack of the Clones,,
Poggle the Lesser,183,80,none,green,yellow,NA,male,masculine,Geonosis,Geonosian,"Attack of the Clones, Revenge of the Sith",,
Luminara Unduli,170,56.2,black,yellow,blue,58,female,feminine,Mirial,Mirialan,"Attack of the Clones, Revenge of the Sith",,
@@ -70,19 +72,17 @@ Dexter Jettster,198,102,none,brown,yellow,NA,male,masculine,Ojom,Besalisk,Attack
Lama Su,229,88,none,grey,black,NA,male,masculine,Kamino,Kaminoan,Attack of the Clones,,
Taun We,213,NA,none,grey,black,NA,female,feminine,Kamino,Kaminoan,Attack of the Clones,,
Jocasta Nu,167,NA,white,fair,blue,NA,female,feminine,Coruscant,Human,Attack of the Clones,,
-Ratts Tyerell,79,15,none,"grey, blue",unknown,NA,male,masculine,Aleen Minor,Aleena,The Phantom Menace,,
R4-P17,96,NA,none,"silver, red","red, blue",NA,none,feminine,NA,Droid,"Attack of the Clones, Revenge of the Sith",,
Wat Tambor,193,48,none,"green, grey",unknown,NA,male,masculine,Skako,Skakoan,Attack of the Clones,,
San Hill,191,NA,none,grey,gold,NA,male,masculine,Muunilinst,Muun,Attack of the Clones,,
Shaak Ti,178,57,none,"red, blue, white",black,NA,female,feminine,Shili,Togruta,"Attack of the Clones, Revenge of the Sith",,
Grievous,216,159,none,"brown, white","green, yellow",NA,male,masculine,Kalee,Kaleesh,Revenge of the Sith,Tsmeu-6 personal wheel bike,Belbullab-22 starfighter
Tarfful,234,136,brown,brown,blue,NA,male,masculine,Kashyyyk,Wookiee,Revenge of the Sith,,
-Raymus Antilles,188,79,brown,light,brown,NA,male,masculine,Alderaan,Human,"Revenge of the Sith, A New Hope",,
+Raymus Antilles,188,79,brown,light,brown,NA,male,masculine,Alderaan,Human,"A New Hope, Revenge of the Sith",,
Sly Moore,178,48,none,pale,white,NA,NA,NA,Umbara,NA,"Attack of the Clones, Revenge of the Sith",,
Tion Medon,206,80,none,grey,black,NA,male,masculine,Utapau,Pau'an,Revenge of the Sith,,
Finn,NA,NA,black,dark,dark,NA,male,masculine,NA,Human,The Force Awakens,,
Rey,NA,NA,brown,light,hazel,NA,female,feminine,NA,Human,The Force Awakens,,
-Poe Dameron,NA,NA,brown,light,brown,NA,male,masculine,NA,Human,The Force Awakens,,T-70 X-wing fighter
+Poe Dameron,NA,NA,brown,light,brown,NA,male,masculine,NA,Human,The Force Awakens,,X-wing
BB8,NA,NA,none,none,black,NA,none,masculine,NA,Droid,The Force Awakens,,
-Captain Phasma,NA,NA,unknown,unknown,unknown,NA,NA,NA,NA,NA,The Force Awakens,,
-Padmé Amidala,165,45,brown,light,brown,46,female,feminine,Naboo,Human,"Attack of the Clones, The Phantom Menace, Revenge of the Sith",,"H-type Nubian yacht, Naboo star skiff, Naboo fighter"
+Captain Phasma,NA,NA,none,none,unknown,NA,female,feminine,NA,Human,The Force Awakens,,
diff --git a/data/starwars.rda b/data/starwars.rda
index 8d5109530b..8f7c8fe7ca 100644
Binary files a/data/starwars.rda and b/data/starwars.rda differ
diff --git a/man/starwars.Rd b/man/starwars.Rd
index ba3386f49f..2127a49124 100644
--- a/man/starwars.Rd
+++ b/man/starwars.Rd
@@ -25,7 +25,7 @@ A tibble with 87 rows and 14 variables:
starwars
}
\description{
-The original data, from SWAPI, the Star Wars API, \url{https://swapi.dev/}, has been revised
+The original data, from SWAPI, the Star Wars API, \url{https://swapi.py4e.com/}, has been revised
to reflect additional research into gender and sex determinations of characters.
}
\examples{