The goal of this challenge is to read complex data on wins and losses for all World Series games.

  1. Read R documentation for function scan. In particular pay attention to attributes what, skip, and nlines
  2. Use scan to read data on wins and losses for all World Series games. Make a numeric vector for years and a character vector for the patterns of wins and losses
  3. The function scan reads from left to right, but the dataset is organized by columns and so the years appear in a strange order. Use function order to order the data chronologically
  4. Finally make a data frame with the year and pattern components
# Read the dataset with function scan
world_series <- scan("http://lib.stat.cmu.edu/datasets/wseries",
                     ___, # - Skip the first 35 lines
                     ___, # - Then read 23 lines of data
                     ___) # - The data occurs in pairs: a year (numeric) and a pattern (character)


# find a sorting permutation of sorted years (use function order)
perm <- order(___)

# using the sorting permutation make a data frame with sorted information about years and patterns
world_series <- data.frame(year = ___, pattern = ___)