Aan de slagGa gratis aan de slag

Space race timeline

The "first" space race began as the United States and the Soviet Union tried to become the global force in spaceflight. This race peaked on July 20, 1969, when Apollo 11, a crewed spacecraft, landed on the moon. In this exercise, your task is to create a time series plot summarizing the first space race: the race for spaceflight superiority by countries.

The plotly, crosstalk, and dplyr packages are already loaded.

Deze oefening maakt deel uit van de cursus

Intermediate Interactive Data Visualization with plotly in R

Cursus bekijken

Oefeninstructies

  • Create a new SharedData object from the state_launches data frame.
  • Create a line chart displaying the number of launches by year (launch_year) for each state (state_code).
  • Plot each line in a different color.
  • Enable selection (i.e. highlighting) of an individual state.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# table of launches by year
state_launches <- launches %>% 
  filter(agency_type == "state") %>% 
  count(launch_year, state_code)

# create a ShareData object for plotting
shared_launches <- state_launches %>% ___(key = ___)

# Create a line chart for launches by state, with highlighting
shared_launches %>%
  ___(___, ___, ___) %>%
  ___() %>%
  ___()
Code bewerken en uitvoeren