9.3 Data challenge: Out of this world

Our next data challenge focuses on the space exploration data set from Our World in Data. This data set contains the number of objects (satellites, probes, landers, crewed spacecrafts, space station flight elements) that were launched into outer space per year and country.

  1. Load the data set into R using the command objInSpace <- read.csv(url("https://runifr.netlify.app/web/yearly-number-of-objects-launched-into-outer-space.csv"))

  2. Get familiar with the data set: What are the dimensions? What are the columns names?

  3. How many times does each Entity occur in the data set? Hint: One approach is to write a for-loop over all unique entities and print the name of the entity and how many times it occurs.

  4. There is a more efficient (and less verbose) approach to answer the question above - can you find the command using google?

  5. Extract all the rows where Entity is “European Space Agency” and store them in a new data frame called objInSpaceESA.

  6. In which year does the cumulative number of objects in space for objInSpaceESA exceed 30? Try different approaches to answer this question, e.g. using a for-loop, a while loop or the command cumsum.

  7. Now plot the of yearly launches against the years for objInSpaceESA. Try to make a nice plot, i.e. use good axis labels, a title, and play with different types (p, l or b).

  8. Add a line to your plot with the yearly launches into space for the entity “United States”. Note that you need to adjust the limit of both x- and y-axis such that both lines are visible (using xlim and ylim). Use a different color and/or line type for the two lines.

  9. Add a legend to your plot.

  10. Add a horizontal line to the plot that to the magical number of 100 yearly launches.

  11. Your plot contains very small numbers and very large numbers, however, it is difficult to distinguish the small numbers since the y-axis is “dominated” by the large numbers and the small numbers are squeezed at the bottom. In such cases, it makes sense to plot the data on a logarithmic scale, as then every unit of length corresponds to multiplying (instead of adding) the previous value by the same amount. Try this on the previous plot: Plot log(yearly_launches, base = 10) for both “European Space Agency” and “United States”. Make sure that the y-axis denotes the non-transformed values (using axis).

  12. Plot 9 panels in 3x3 layout, where each panel should plot the yearly launches into space against the years for the entities Argentina, Australia, Brazil, Canada, China, France, Germany, India and Luxembourg. Use a for-loop.

  13. Prepare an empty plot. Loop over all unique entities of the full data set, and check for each entity if the total number of launches across all years is larger than 10. If this is the case, add a line with the yearly launches of that entity to your plot (each with a different color).