Launch Pad 39a Kennedy Space Center, USA. Photo by Terrence Burke. 1985

Launch Pad 39a Kennedy Space Center, USA. Photo by Terrence Burke. 1985

Background

The Space Race was a 20th-century competition between two Cold War rivals, the Soviet Union (USSR) and the United States (US), to achieve firsts in spaceflight capability. It had its origins in the ballistic missile-based nuclear arms race between the two nations following World War II. The technological advantage required to rapidly achieve spaceflight milestones was seen as necessary for national security, and mixed with the symbolism and ideology of the time. The Space Race led to pioneering efforts to launch artificial satellites, uncrewed space probes of the Moon, Venus, and Mars, and human spaceflight in low Earth orbit and to the Moon.

The competition began in earnest on August 2, 1955, when the Soviet Union responded to the US announcement four days earlier of intent to launch artificial satellites for the International Geophysical Year, by declaring they would also launch a satellite “in the near future”. The Soviet Union achieved the first successful launch with the October 4, 1957, orbiting of Sputnik 1, and sent the first human to space with the orbital flight of Yuri Gagarin on April 12, 1961. The USSR also sent the first woman, Valentina Tereshkova, to space on June 16, 1963, with numerous other firsts taking place over the next few years with regards to flight duration, spacewalks and related activities. According to Russian sources, these achievements led to the conclusion that the USSR had an advantage in space technology in the early 1960s.

After US president John F. Kennedy raised the stakes by setting a goal of “landing a man on the Moon and returning him safely to the Earth”, both countries worked on developing super heavy-lift launch vehicles,…. Kennedy’s moon landing goal was achieved in July 1969. For more on the Space Race see Wikipedia.

It is said that by landing on the moon, the United States effectively won the space race that had begun with Sputnik’s launch in 1957. See Appendix for some notable achievements in space flight.

Data

The data set can be found on kaggle. It was scraped from nextspaceflight and includes all the space missions since the beginning of the Space Race (1957). The data set has 4,324 observations and 7 variables.

This data visualization will only consider the Cold War Space Race Missions (1957-1991) for the United States and the Soviet Union.

library(plotly) # interactive visualization
library(plyr)
library(tidyverse) # data manipulation
library(lubridate) # for working with dates and times
library(ggthemes) # graph customization
library(stringr) # text functions
library(ggplot2) # graphs
library(strex) # text functions
library(gridExtra)
library(kableExtra)
library(naniar) # missing data statistics
library(forcats) # tools for factor variables
# Space Missions data
df <- read.csv("./Data/space_missions.csv", header = TRUE, na.strings=c("NA", ""))
# Rocket Country data
# rc <- read.csv("./Data/rocket_country.csv", header = TRUE)
# Look at data
#glimpse(df)
# Remove the first two variables; these are unnecessary.
df <- df[, -c(1:2)]   
glimpse(df)
Rows: 4,324
Columns: 7
$ Company.Name   <chr> "SpaceX", "CASC", "SpaceX", "Roscosmos", "ULA", "CASC",…
$ Location       <chr> "LC-39A, Kennedy Space Center, Florida, USA", "Site 940…
$ Datum          <chr> "Fri Aug 07, 2020 05:12 UTC", "Thu Aug 06, 2020 04:01 U…
$ Detail         <chr> "Falcon 9 Block 5 | Starlink V1 L9 & BlackSky", "Long M…
$ Status.Rocket  <chr> "StatusActive", "StatusActive", "StatusActive", "Status…
$ Rocket         <chr> "50.0 ", "29.75 ", NA, "65.0 ", "145.0 ", "64.68 ", "48…
$ Status.Mission <chr> "Success", "Success", "Success", "Success", "Success", …

Data Preprocessing

It is important to note that the Location is not necessarily the country of ownership of the rocket nor the payload. For example, 9 missions were launched from Kenya; however, all rockets belong to the United States. Of these 9 launches, 4 payloads were for Italy and 5 for the United States. So if one wants to know how many missions did the USA conduct? We would want to count how many rockets were launched by the USA. But if one wants to know which country operates its own satellite? We would have to consider the payload data, i.e., map the payload to the country that commissioned the launch. 7 new variables were created from this data as follows: The Datum variable contains information on launch_date and year of launch. The country or geographical location was extracted from Location and captured in the new variable Launch.Site. The Detail variable contains the rocket/payload data - the information before the pipe operator is the rocket name and the information that follows is the payload. The data from this was extracted and captured in two variables: rocket.name and payload. The Rocket variable contains the cost; this was renamed as Mission.Cost. A Google search helped with determining the Rocket.Family and Rocket.Country. In most cases the rocket family is the same as the rocket name; and, the rocket country is the same as the location from where the launch happened.

df <- df %>% #mutate(Launch.Site = str_extract(Location, "\\w+$")) %>% 
    mutate(Launch.Site = str_after_last(Location, "\\, ")) %>%
    rename(Mission.Cost = Rocket) %>%
    mutate(rocket.name = str_before_last(Detail, "\\| ")) %>% 
    mutate(payload = str_after_first(Detail, "\\| ")) %>%
    mutate(launch_date = as_date(parse_date_time(Datum, c("mdy HM", "mdy"), tz = "UTC"))) %>%
    mutate(year = year(launch_date)) 
# Create variable containing rocket family name

df$Rocket.Family[grepl("Zenit", df$rocket.name, ignore.case = TRUE)] <- "Zenit"
df$Rocket.Family[grepl("Vostok", df$rocket.name, ignore.case = TRUE)] <- "Vostok"
df$Rocket.Family[grepl("ZhuQue", df$rocket.name, ignore.case = TRUE)] <- "ZhuQue"
df$Rocket.Family[grepl("Volna", df$rocket.name, ignore.case = TRUE)] <- "Volna"
df$Rocket.Family[grepl("Voskhod", df$rocket.name, ignore.case = TRUE)] <- "Voskhod"
df$Rocket.Family[grepl("VLS", df$rocket.name, ignore.case = TRUE)] <- "VLS"
df$Rocket.Family[grepl("Vega", df$rocket.name, ignore.case = TRUE)] <- "Vega"
df$Rocket.Family[grepl("Vanguard", df$rocket.name, ignore.case = TRUE)] <- "Vanguard"
df$Rocket.Family[grepl("Unha", df$rocket.name, ignore.case = TRUE)] <- "Unha"
df$Rocket.Family[grepl("Tsyklon", df$rocket.name, ignore.case = TRUE)] <- "Tsyklon"
df$Rocket.Family[grepl("Titan|Commercial Titan III", df$rocket.name, ignore.case = TRUE)] <- "Titan"
df$Rocket.Family[grepl("Thor", df$rocket.name, ignore.case = TRUE)] <- "Thor"
df$Rocket.Family[grepl("Taepodong", df$rocket.name, ignore.case = TRUE)] <- "Taepodong"
df$Rocket.Family[grepl("Super Stripy", df$rocket.name, ignore.case = TRUE)] <- "Super Stripy"
df$Rocket.Family[grepl("Strela", df$rocket.name, ignore.case = TRUE)] <- "Strela"
df$Rocket.Family[grepl("Start", df$rocket.name, ignore.case = TRUE)] <- "Start"
df$Rocket.Family[grepl("Starship", df$rocket.name, ignore.case = TRUE)] <- "Starship"
df$Rocket.Family[grepl("SS-520", df$rocket.name, ignore.case = TRUE)] <- "S-Series"
df$Rocket.Family[grepl("Sputnik", df$rocket.name, ignore.case = TRUE)] <- "Sputnik"
df$Rocket.Family[grepl("Endeavour", df$rocket.name, ignore.case = TRUE)] <- "Endeavour"
df$Rocket.Family[grepl("Discovery", df$rocket.name, ignore.case = TRUE)] <- "Discovery"
df$Rocket.Family[grepl("Columbia",  df$rocket.name, ignore.case = TRUE)] <- "Columbia"
df$Rocket.Family[grepl("Challenger", df$rocket.name, ignore.case = TRUE)] <- "Challenger"
df$Rocket.Family[grepl("Atlantis", df$rocket.name, ignore.case = TRUE)] <- "Atlantis"
df$Rocket.Family[grepl("Soyuz", df$rocket.name, ignore.case = TRUE)] <- "Soyuz"
df$Rocket.Family[grepl("Simorgh", df$rocket.name, ignore.case = TRUE)] <- "Simorgh"
df$Rocket.Family[grepl("Shtil'", df$rocket.name, ignore.case = TRUE)] <- "Shtil'"
df$Rocket.Family[grepl("Shavit", df$rocket.name, ignore.case = TRUE)] <- "Shavit"
df$Rocket.Family[grepl("Scout|Blue Scout II", df$rocket.name, ignore.case = TRUE)] <- "Scout"
df$Rocket.Family[grepl("Saturn",  df$rocket.name, ignore.case = TRUE)] <- "Saturn"
df$Rocket.Family[grepl("SARGE", df$rocket.name, ignore.case = TRUE)] <- "SARGE"
df$Rocket.Family[grepl("Safi" , df$rocket.name, ignore.case = TRUE)] <- "Safi"
df$Rocket.Family[grepl("Rokot", df$rocket.name, ignore.case = TRUE)] <- "Rokot"
df$Rocket.Family[grepl("Redstone Sparta|Mercury-Redstone" , df$rocket.name, ignore.case = TRUE)] <- "Redstone"
df$Rocket.Family[grepl("Qased", df$rocket.name, ignore.case = TRUE)] <- "Qased"
df$Rocket.Family[grepl("PSLV|ASLV|SLV-3", df$rocket.name, ignore.case = TRUE)] <- "SLV"
df$Rocket.Family[grepl("Proton", df$rocket.name, ignore.case = TRUE)] <- "Proton"
df$Rocket.Family[grepl("Poliot", df$rocket.name, ignore.case = TRUE)] <- "Poliot"
df$Rocket.Family[grepl("Pegasus",  df$rocket.name, ignore.case = TRUE)] <- "Pegasus"
df$Rocket.Family[grepl("OS-M1", df$rocket.name, ignore.case = TRUE)] <- "OneSpace"
df$Rocket.Family[grepl("NOTS-EV-1", df$rocket.name, ignore.case = TRUE)] <- "NOTS-EV-1"
df$Rocket.Family[grepl("New Shepard", df$rocket.name, ignore.case = TRUE)] <- "New Shepard"
df$Rocket.Family[grepl("Naro", df$rocket.name, ignore.case = TRUE)] <- "Naro"
df$Rocket.Family[grepl("N1-L3", df$rocket.name, ignore.case = TRUE)] <- "N1-L3"
df$Rocket.Family[grepl("N-I|N-II", df$rocket.name, ignore.case = TRUE)] <- "NI/NII (Delta)"
df$Rocket.Family[grepl("Mu-V|Mu-IV|Mu-III", df$rocket.name, ignore.case = TRUE)] <- "Mu Series"
df$Rocket.Family[grepl("Molniya-M|Molniya", df$rocket.name, ignore.case = TRUE)] <- "Molniya"
df$Rocket.Family[grepl("Minotaur V|Minotaur I|Minotaur C" , df$rocket.name, ignore.case = TRUE)] <- "Minotaur"

df$Rocket.Family[grepl("Lambda" , df$rocket.name, ignore.case = TRUE)] <- "Lambda"
df$Rocket.Family[grepl("Long March" , df$rocket.name, ignore.case = TRUE)] <- "Long March"
df$Rocket.Family[grepl("LauncherOne", df$rocket.name, ignore.case = TRUE)] <- "LauncherOne"
df$Rocket.Family[grepl("Kuaizhou", df$rocket.name, ignore.case = TRUE)] <- "Kuaizhou"
df$Rocket.Family[grepl("Kaituozhe 1|Kaituozhe 2" , df$rocket.name, ignore.case = TRUE)] <- "Kaituozhe"

df$Rocket.Family[grepl("Juno I|Juno II", df$rocket.name, ignore.case = TRUE)] <- "Redstone"
df$Rocket.Family[grepl("Jielong-1" , df$rocket.name, ignore.case = TRUE)] <- "Jielong"
df$Rocket.Family[grepl("Hyperbola-1" , df$rocket.name, ignore.case = TRUE)] <- "Hyperbola"
df$Rocket.Family[grepl("H-IIS|H-IIB|H-II|H-II", df$rocket.name, ignore.case = TRUE)] <- "H-II"
df$Rocket.Family[grepl("H-I", df$rocket.name, ignore.case = TRUE)] <- "H-I"
df$Rocket.Family[grepl("GSLV Mk III|GSLV Mk II|GSLV Mk I", df$rocket.name, ignore.case = TRUE)] <- "GSLV"
df$Rocket.Family[grepl("Feng Bao 1", df$rocket.name, ignore.case = TRUE)] <- "Feng Bao"
df$Rocket.Family[grepl("Falcon Heavy|Falcon 9|Falcon 1", df$rocket.name, ignore.case = TRUE)] <- "Falcon"
df$Rocket.Family[grepl("Europa 1|Europa 2", df$rocket.name, ignore.case = TRUE)] <- "Europa"
df$Rocket.Family[grepl("Electron|Electron/Curie", df$rocket.name, ignore.case = TRUE)] <- "Electron"
df$Rocket.Family[grepl("Energiya/Buran|Energiya/Polyus", df$rocket.name, ignore.case = TRUE)] <- "Energiya"
df$Rocket.Family[grepl("Epsilon", df$rocket.name, ignore.case = TRUE)] <- "Epsilon"
df$Rocket.Family[grepl("Dnepr", df$rocket.name, ignore.case = TRUE)] <- "Dnepr"
df$Rocket.Family[grepl("Diamant BP4|Diamant B|Diamant A", df$rocket.name, ignore.case = TRUE)] <- "Diamant"
df$Rocket.Family[grepl("Delta|Delta A|Delta B|Delta II|Delta III|Delta IV", df$rocket.name, ignore.case = TRUE)] <- "Delta"
df$Rocket.Family[grepl("Cosmos", df$rocket.name, ignore.case = TRUE)] <- "Cosmos"
df$Rocket.Family[grepl("Conestoga", df$rocket.name, ignore.case = TRUE)] <- "Conestoga"
df$Rocket.Family[grepl("Black Arrow", df$rocket.name, ignore.case = TRUE)] <- "Black Arrow"
df$Rocket.Family[grepl("Atlas", df$rocket.name, ignore.case = TRUE)] <- "Atlas"
df$Rocket.Family[grepl("Athena II|Athena I", df$rocket.name, ignore.case = TRUE)] <- "Athena"
df$Rocket.Family[grepl("Ariane", df$rocket.name, ignore.case = TRUE)] <- "Ariane"
df$Rocket.Family[grepl("Ares", df$rocket.name, ignore.case = TRUE)] <- "Ares"
df$Rocket.Family[grepl("Antares", df$rocket.name, ignore.case = TRUE)] <- "Antares"
df$Rocket.Family[grepl("Angara", df$rocket.name, ignore.case = TRUE)] <- "Angara"

# Join data containing rocket/country relationship
#df <- df %>% inner_join(rc)
#library(plyr)
df$Rocket.Country <- mapvalues(df$Launch.Site, from = c("Kenya", "USA", "Russia", "Kazakhstan"), to = c("United States", "United States", "Soviet Union", "Soviet Union"))

glimpse(df)
Rows: 4,324
Columns: 14
$ Company.Name   <chr> "SpaceX", "CASC", "SpaceX", "Roscosmos", "ULA", "CASC",…
$ Location       <chr> "LC-39A, Kennedy Space Center, Florida, USA", "Site 940…
$ Datum          <chr> "Fri Aug 07, 2020 05:12 UTC", "Thu Aug 06, 2020 04:01 U…
$ Detail         <chr> "Falcon 9 Block 5 | Starlink V1 L9 & BlackSky", "Long M…
$ Status.Rocket  <chr> "StatusActive", "StatusActive", "StatusActive", "Status…
$ Mission.Cost   <chr> "50.0 ", "29.75 ", NA, "65.0 ", "145.0 ", "64.68 ", "48…
$ Status.Mission <chr> "Success", "Success", "Success", "Success", "Success", …
$ Launch.Site    <chr> "USA", "China", "USA", "Kazakhstan", "USA", "China", "K…
$ rocket.name    <chr> "Falcon 9 Block 5 ", "Long March 2D ", "Starship Protot…
$ payload        <chr> "Starlink V1 L9 & BlackSky", "Gaofen-9 04 & Q-SAT", "15…
$ launch_date    <date> 2020-08-07, 2020-08-06, 2020-08-04, 2020-07-30, 2020-0…
$ year           <dbl> 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2…
$ Rocket.Family  <chr> "Falcon", "Long March", "Starship", "Proton", "Atlas", …
$ Rocket.Country <chr> "United States", "China", "United States", "Soviet Unio…

Data Visualization

# Get launch count for each country
site = df %>% 
  filter( year %in% (1957:1991)) %>%
  group_by(Launch.Site) %>%
  dplyr::summarize(Missions = n()) %>% arrange(desc(Missions))

site %>%
  kbl(caption = "Total Space Race Missions by Launch Site, 1957-1991") %>%
  kable_minimal("hover", full_width = F, position="left")
Total Space Race Missions by Launch Site, 1957-1991
Launch.Site Missions
Russia 1188
USA 662
Kazakhstan 582
France 61
Japan 52
China 38
Kenya 9
India 7
Australia 6
Israel 2
df2 <- df %>% 
  filter(Rocket.Country %in% c("United States", "Soviet Union")  &  year %in% c(1957:1991)) %>%
  group_by(Rocket.Country) %>%
  dplyr::summarize(Count = n()) %>% arrange(desc(Count))

bar.fig <- ggplot(df2, aes(x=reorder(Rocket.Country, Count), y=Count,
                           text=paste0("Rocket Country: ", Rocket.Country))) +
  geom_bar(stat="identity", fill = "lightblue") +
  coord_flip()+
  xlab("") + ylab("Number of Missions") + labs(title = "Total Space Race Missions by Country") +
  
  theme_gray() 

ggplotly(bar.fig, tooltip = c("y")) %>% config(displayModeBar = FALSE) %>% layout(title = list(text=paste0("Total Space Race Missions by Cold War Rivals", '<br>', '<sup>', "Data: 1957 to 1991; Soviet Union = Russia + Kazakhstan; (hover for counts)", '</sup>')))
library(janitor)

missions <- df %>% 
  filter(Rocket.Country %in% c("United States", "Soviet Union")  &  year %in% c(1957:1991)) %>%
  mutate(Country = Rocket.Country) %>%
  mutate(Status = Status.Mission) %>%
  tabyl(Country, Status) %>%
  adorn_totals(where = c("row", "col")) %>%
  adorn_percentages("row") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title("combined")
 
missions %>% kable(caption = "Table 1: Descriptive Statistics of Cold War Rivals by Mission Status.") %>% 
  kable_styling(bootstrap_options = c("condensed", "striped", "bordered"))
Table 1: Descriptive Statistics of Cold War Rivals by Mission Status.
Country/Status Failure Partial Failure Prelaunch Failure Success Total
Soviet Union 120 (6.8%) 41 (2.3%) 1 (0.1%) 1608 (90.8%) 1770 (100.0%)
United States 101 (15.1%) 25 (3.7%) 0 (0.0%) 545 (81.2%) 671 (100.0%)
Total 221 (9.1%) 66 (2.7%) 1 (0.0%) 2153 (88.2%) 2441 (100.0%)
space_map <- df %>% 
    filter(Rocket.Country %in% c("United States", "Soviet Union")  &  year %in% c(1957:1991)) %>%
    #mutate(Location = str_extract(Location, "(USA)|(Russia)")) %>%
    #filter(!is.na(Location)) %>%
    count(Rocket.Country, Day = wday(launch_date, label=TRUE),     Month=month(launch_date, label=TRUE)) %>%
    filter(!is.na(Day), !is.na(Month)) %>%
    ggplot(aes(x=Day, y=Month, fill=n, 
               text=paste0("Missions: ", n))) +
    geom_tile() +
    facet_grid(~Rocket.Country) +
    theme_minimal() +
    scale_fill_gradient(low="#8de1f0", high="black") +
    labs(title = "Times of Space Missions") +
    theme(panel.grid.major=element_blank(),
          panel.grid.minor=element_blank(),
          #text = element_text(family="DM Sans"),
          plot.title = element_text(hjust = 0.5),
          legend.position = "none")
ggplotly(space_map, tooltip = c("x", "y", "text")) %>% config(displayModeBar = FALSE) %>% layout(title = list(text=paste0("Space Race Missions by Month & Day", '<br>', '<sup>', "Data: 1957 to 1991; (hover for counts)", '</sup>')))
#myColors = c("#ed4c28", "#f2ce49")
myColors = c("orange", "lightblue")

p <- df %>% select(year, Rocket.Country) %>%
    filter(Rocket.Country %in% c("United States", "Soviet Union")  &  year %in% c(1957:1991)) %>%
    group_by(year, Rocket.Country) %>%
    summarise(Missions = n()) %>%
    arrange(desc(Missions)) %>%
  ggplot(aes(x=year, y=Missions, fill=Rocket.Country,
             text=paste0("Year: ", year,
                         "\nMissions: ", `Missions`,
                         "\nCountry: ", Rocket.Country))) +
    geom_col(position = "fill") +
    xlab("Year") + ylab("Percent of Missions") +
        labs(title = "Total Space Race Missions", subtitle = "Data: 1957 to 1991") +
    #scale_x_continuous(breaks = seq(from = 1957, to= 1991, by =3)) +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)", values=myColors) 

ggplotly(p, tooltip = c("text")) %>% config(displayModeBar = FALSE) %>%
    layout(title = list(text=paste0("Cold War Rivals: Total Space Race Missions by Year", '<br>', '<sup>', "Data: 1957 to 1991; (hover for more info)", '</sup>')))
myColors2 = c("#ed4c28", "#f2ce49", "#41C475")
p_USA <- df %>% select(year, Status.Mission, Rocket.Country) %>%
    filter(Rocket.Country %in% c("United States")  &  year %in% (1957:1991)) %>%
    group_by(year, Status.Mission) %>%
    summarise(Missions = n()) %>%
    arrange(desc(Missions)) %>%
    ggplot(aes(x=year, y=Missions, fill=Status.Mission,
               text=paste0("Year: ", year,
                           "\nStatus: ", `Status.Mission`))) +
    geom_col() +
    labs(title = "Space Race Missions, USA (1957-1991)") +
    xlab("Year") + ylab("Number of Missions") +
    #scale_x_continuous(breaks = seq(from = 1957, to= 1991, by =3)) +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)", values=myColors2) +
    theme(plot.title = element_text(hjust =0.5))
ggplotly(p_USA, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
 layout(title = list(text=paste0("United States Space Race Missions by Year & Status", '<br>', '<sup>', "Data: 1957 to 1991; (hover for more info)", '</sup>')))
myColors = c("#ed4c28", "#f2ce49", "#ed77be", "#41C475")
p_USSR <- df %>% select(year, Status.Mission, Rocket.Country) %>%
    filter(Rocket.Country %in% c("Soviet Union")  &  year %in% (1957:1991)) %>%
    group_by(year, Status.Mission) %>%
    dplyr::summarise(Missions = n()) %>%
    arrange(desc(Missions)) %>%
    ggplot(aes(x=year, y=Missions, fill=Status.Mission,
           text=paste0("Year: ", year,
                       "\nStatus: ", `Status.Mission`))) +
    geom_col() +
    labs(title = "Soviet Union Space Race Missions (1957-1991)") +
    xlab("Year") + ylab("Number of Missions") +
    #scale_x_continuous(breaks = seq(from = 1957, to= 1991, by =3)) +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)", values=myColors) +
    theme(text = element_text(),
        plot.title = element_text(hjust = 0.5))

ggplotly(p_USSR, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
    layout(title = list(text=paste0("Soviet Union Space Race Missions by Year & Status", '<br>', '<sup>', "Data: 1957 to 1991; (hover for more info)", '</sup>')))
df %>% select(year, Rocket.Country, Status.Mission) %>%
   filter(Rocket.Country %in% c("United States")  &  year %in% c(1957:1991)) %>% 
   count(Status.Mission) %>%
   mutate(prop = paste0(round(n / sum(n) * 100, 2), "%")) %>%
   ggplot(aes(x = Status.Mission, y = prop)) +
   geom_bar(aes(fill=Status.Mission), stat="identity") +
   coord_flip() +
   scale_fill_manual(values = c("#ed4c28", "#f2ce49", "#41C475")) +
   geom_text(aes(y = prop, label = prop), hjust = 1.1, size = 4, col = "white",
             fontface = "bold") +
    theme(legend.position = "none", 
          axis.title.x = element_blank(),
          axis.text.x= element_blank(),
          axis.ticks.x = element_blank()) +
    labs(title = "United States Space Race Missions as Percent Status",
         subtitle = "",
         caption = "Data: USA from 1957 to 1991",
         x = "")

df %>% select(year, Rocket.Country, Status.Mission) %>%
    filter(Rocket.Country %in% c("Soviet Union")  &  year %in% c(1957:1991)) %>% 
    count(Status.Mission) %>%
    mutate(prop = paste0(round(n / sum(n) * 100, 2), "%")) %>%
    ggplot(aes(fct_reorder(Status.Mission, prop), y=prop )) +
    geom_col(aes(fill=Status.Mission)) +
    coord_flip() +
    scale_fill_manual(values = c("#ed4c28", "#f2ce49", "#ed77be", "#41C475")) +
    geom_text(aes(y = prop, label = prop), hjust = 1.1, size = 4, col = "white",
              fontface = "bold") +
    theme(legend.position = "none", 
          axis.title.x = element_blank(),
          axis.text.x= element_blank(),
          axis.ticks.x = element_blank()) +
    labs(title = "Soviet Union Space Race Missions as Percent Status",
         subtitle = "",
         caption = "Data: USSR from 1957 to 1991",
         x = "")  

df$status = ifelse(df$Status.Mission %in% c("Failure", "Partial Failure"), "Failure", "Success")
  
p_usa <- df %>% select(year, status, Rocket.Country) %>%
    filter(Rocket.Country %in% c("United States")  &  year %in% (1957:1991)) %>%
    mutate(status = as.factor(status)) %>%
    group_by(year, status) %>%
    dplyr::summarise(count_status = n()) %>%
    mutate(percent = paste0(round(count_status / sum(count_status) * 100, 0), "%")) %>%
    ungroup() %>%
    ggplot(aes( x = year, y = count_status,
                group = status, text=paste0("Year: ", year,
                                            "\nStatus: ", status,
                                            "\nPercent: ", percent,
                                            "\nCount: ", count_status))) +
    geom_bar(aes(fill = status), stat = "identity") +
    xlab("Year") + ylab("Count") +
        labs(title = "Total Space Race Missions", subtitle = "Data: 1957 to 1991",
             caption = "Failure is sum of all failures") +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)", values= c("#ed4c28", "#41C475"), theme(text = element_text(), plot.title = element_text(hjust=0.5))) 

  ggplotly(p_usa, tooltip = c("text")) %>% config(displayModeBar = FALSE) %>%
  
  layout(title = list(text=paste0("United States Mission Status as Percent of Total by Year", '<br>', '<sup>', "Data: 1957 to 1991; (hover for %). Note: Failure is sum of all failure type", '</sup>'))) 
df$status = ifelse(df$Status.Mission %in% c("Failure", "Partial Failure", "Prelaunch Failure"), "Failure", "Success")
  
p_usa <- df %>% select(year, status, Rocket.Country) %>%
    filter(Rocket.Country %in% c("Soviet Union")  &  year %in% (1957:1991)) %>%
    mutate(status = as.factor(status)) %>%
    group_by(year, status) %>%
    dplyr::summarise(count_status = n()) %>%
    mutate(percent = paste0(round(count_status / sum(count_status) * 100, 0), "%")) %>%
    ungroup() %>%
    ggplot(aes( x = year, y = count_status,
                group = status, text=paste0("Year: ", year,
                                            "\nStatus: ", status,
                                            "\nPercent: ", percent,
                                            "\nCount: ", count_status))) +
    geom_bar(aes(fill = status), stat = "identity") +
    xlab("Year") + ylab("Count") +
        labs(title = "Total Space Race Missions", subtitle = "Data: 1957 to 1991",
             caption = "Failure is sum of all failures") +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)", values= c("#ed4c28", "#41C475"), theme(text = element_text(), plot.title = element_text(hjust=0.5))) 

  ggplotly(p_usa, tooltip = c("text")) %>% config(displayModeBar = FALSE) %>%
  
  layout(title = list(text=paste0("Soviet Union Mission Status as Percent of Total by Year", '<br>', '<sup>', "Data: 1957 to 1991; (hover for %). Note: Failure is sum of all failure type", '</sup>'))) 
 df2 <- df %>% 
   filter(Rocket.Country %in% c("United States")  &  year %in% c(1957:1991)) %>% 
   group_by(Rocket.Family) %>%
   summarize(Count = n()) %>% arrange(desc(Count))

 bar.fig <- ggplot(df2, aes(x=reorder(Rocket.Family, Count), y=Count,
                            text=paste0("Rocket Family: ", Rocket.Family))) +
   geom_point(stat="identity", color = "lightblue") +
   coord_flip()+
   xlab("") + ylab("Number of Missions") +
    labs(title = "Rocket Family, United States") +
   theme_bw() 

 ggplotly(bar.fig, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
 layout(title = list(text=paste0("United States Space Race Missions by Rocket Family", '<br>', '<sup>', "Data: 1957 to 1991; (hover for counts)", '</sup>')))
 df2 <- df %>% 
   filter(Rocket.Country %in% c("Soviet Union")  &  year %in% c(1957:1991)) %>% 
   group_by(Rocket.Family) %>%
   summarize(Count = n()) %>% arrange(desc(Count))

 bar.fig <- ggplot(df2, aes(x=reorder(Rocket.Family, Count), y=Count,
                            text=paste0("Rocket Family: ", Rocket.Family))) +
   geom_point(stat="identity", color = "tomato") +
   coord_flip()+
   xlab("") + ylab("Number of Missions") +
    labs(title = "Rocket Family, Soviet Union") +
   theme_bw() 

 ggplotly(bar.fig, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
    layout(title = list(text=paste0("Soviet Union Space Race Missions by Rocket Family ", '<br>', '<sup>', "Data: 1957 to 1991; (hover for counts)", '</sup>')))
df2 <- df %>% 
  filter(Rocket.Country %in% c("United States")  &  year %in% c(1957:1991)) %>% 
  group_by(Company.Name, Status.Mission) %>%
  summarize(Count = n()) %>% arrange(desc(Count))

bar.fig <- ggplot(df2, aes(x=reorder(Company.Name, Count), y=Count, fill=Status.Mission,
                           text=paste0("Manufacturer: ", Company.Name))) +
  geom_col(stat="identity") +
  coord_flip()+
  xlab("") + ylab("Number of Missions") + labs(title= "United States Space Missions by Company & Status") +
  scale_fill_manual("Mission Status\n(click a label\n to isolate)",   values=myColors2) +
  theme_bw() 
ggplotly(bar.fig, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
  layout(title = list(text=paste0("United States Space Race Missions by Company & Status", '<br>', '<sup>', "Data: 1957 to 1991; (hover for counts)", '</sup>')))
 df2 <- df %>% 
   filter(Rocket.Country %in% c("Soviet Union")  &  year %in% c(1957:1991)) %>% 
   group_by(Company.Name, Status.Mission) %>%
   summarize(Count = n()) %>% arrange(desc(Count))
 
 bar.fig <- ggplot(df2, aes(x=reorder(Company.Name, Count), y=Count,  fill=Status.Mission, text=paste0("Manufacturer: ", Company.Name))) +
   geom_bar(stat="identity") +
   coord_flip()+
   xlab("") + ylab("Number of Missions") + labs(title= "Soviet Union Space Missions by Company") +
    scale_fill_manual("Mission Status\n(click a label\n to isolate)",    values=myColors) + 
   theme_bw() 
 
 ggplotly(bar.fig, tooltip = c("y", "text")) %>% config(displayModeBar = FALSE) %>%
  layout(title = list(text=paste0("Soviet Union Space Race Missions by Company & Status", '<br>', '<sup>', "Data: 1957 to 1991; (hover for counts)", '</sup>')))
fig <- df %>% select(year, Rocket.Country, Company.Name) %>%
  filter(Rocket.Country %in% c("United States")  &  year %in% c(1957:1991)) %>% 
  group_by(Company.Name) %>%
  summarize(Missions = n()) %>% 

  ggplot(aes(x = Company.Name, y = Missions)) +
  geom_point(aes(size = Missions, color = Company.Name)) +
  coord_flip() +
  theme(legend.position = "none", 
        axis.title.x = element_blank(),
        axis.text.x= element_blank(),
        axis.ticks.x = element_blank()) +
  labs(title = "United States Space Missions by Company",
       subtitle = "",
       caption = "USA space missions from 1957 to 1991",
       x = "")

ggplotly(fig, tooltip = c("y")) %>% config(displayModeBar = FALSE) %>%
layout(title = list(text=paste0("United States Space Missions by Company Affiliation", '<br>', '<sup>', "Data: 1957 to 1991; Company = manufacturer or user of a rocket; (hover for counts)", '</sup>')))
fig <- df %>% select(year, Rocket.Country, Company.Name) %>%
  filter(Rocket.Country %in% c("Soviet Union")  &  year %in% c(1957:1991)) %>% 
  group_by(Company.Name) %>%
  summarize(Missions = n()) %>% 

  ggplot(aes(x = Company.Name, y = Missions)) +
  geom_point(aes(size = Missions, color = Company.Name)) +
  coord_flip() +
  theme(legend.position = "none", 
        axis.title.x = element_blank(),
        axis.text.x= element_blank(),
        axis.ticks.x = element_blank()) +
  labs(title = "Soviet Union Space Missions by Company Affiliation",
       subtitle = "",
       caption = "USA space missions from 1957 to 1991",
       x = "")

ggplotly(fig, tooltip = c("y")) %>% config(displayModeBar = FALSE) %>%
layout(title = list(text=paste0("Soviet Union Space Missions by Company Affiliation", '<br>', '<sup>', "Data: 1957 to 1991; Company = manufacturer or user of a rocket; (hover for counts)", '</sup>')))

Appendix

library(readxl)

events <- read_excel("./Data/Space_events.xlsx")

events %>%
kbl(caption="Table A-1: Some Notable Space Race Mission Achievements from 1957 to 1991.") %>%
    kable_styling(bootstrap_options = c("striped", "hover", "responsive", "condensed"), font_size = 10) %>%
     row_spec(8, bold = T, background = "") %>%
    footnote(general = "See Timeline of the Space Race on [Wikipedia](https://en.wikipedia.org/wiki/Timeline_of_the_Space_Race).")
Table A-1: Some Notable Space Race Mission Achievements from 1957 to 1991.
Date Mission Achievement Country Rocket Payload
1957-10-04 First artificial Earth satellite Soviet Union Sputnik 8K71PS Sputnik 1
1957-11-03 First mammal (the dog Laika) in orbit around Earth Soviet Union Sputnik 8K71PS Sputnik 2
1959-01-04 First spacecraft in heliocentric orbit Soviet Union Vostok Luna 1
1959-02-28 First satellite in a polar orbit United States Thor-DM18 Discoverer 1
1959-09-14 First hard landing on another celestial body (Moon) Soviet Union Vostok Luna 2
1961-04-12 First human to orbit Earth (Yuri Gagarin) Soviet Union Vostok Vostok 1
1963-06-16 First woman in space (Valentina Tereshkova) Soviet Union Vostok Vostok 6
1969-07-21 First human to walk on the Moon United States Saturn V Apollo 11
1970-12-15 First soft landing on Venus Soviet Union Molniya 8K78M Venera 7
1971-04-19 First space station launched Soviet Union Proton K Salyut 1
1971-11-13 First spacecraft to orbit Mars United States Atlas SLV3C Mariner 9
1971-12-02 First spacecraft to soft-land on Mars Soviet Union Proton K Mars 3
1973-12-03 First spacecraft to fly by Jupiter United States Atlas SLV3C Pioneer 10
1976-07-20 First pictures transmitted from the surface of Mars United States Titan IIIE Viking 1
1979-09-01 First spacecraft to fly by Saturn United States Atlas SLV3C Pioneer 11
1981-04-12 First reusable spacecraft launched and returned from space United States Space Shuttle Columbia STS-1
1986-01-24 First spacecraft to fly by Uranus United States Titan IIIE Voyager 2
1989-08-25 First spacecraft to fly by Neptune United States Titan IIIE Voyager 2
1990-04-24 First large optical space telescope launched United States Space Shuttle Discovery STS-31
Note:
See Timeline of the Space Race on Wikipedia.
library(reshape2)
library(DT)

df1 <-  df %>% 
  select(year, Rocket.Family, Rocket.Country, Company.Name) %>%
  filter(Rocket.Country %in% c("United States")  &  year %in% c(1957:1991))

df1 <- dcast(df1, Rocket.Family~Company.Name)

DT::datatable(df1, caption = "Table A-2 : Unites States launch vehicle family by company affiliation.", colnames = c('Vehicle Family'=1), rownames = FALSE, options = list(pageLength =5))

Missing data analysis

# Get missing data statistics
miss_var_summary(df)
# A tibble: 15 × 3
   variable       n_miss pct_miss
   <chr>           <int>    <dbl>
 1 Mission.Cost     3360     77.7
 2 Company.Name        0      0  
 3 Location            0      0  
 4 Datum               0      0  
 5 Detail              0      0  
 6 Status.Rocket       0      0  
 7 Status.Mission      0      0  
 8 Launch.Site         0      0  
 9 rocket.name         0      0  
10 payload             0      0  
11 launch_date         0      0  
12 year                0      0  
13 Rocket.Family       0      0  
14 Rocket.Country      0      0  
15 status              0      0