1. Start a new Rmd document by going to File-->New File-->R Markdown-->OK. Save this document under the name yourname_hw9.Rmd. Delete the template Rmarkdown text and chunks (everything starting with ##R Markdown).

  2. Make a new code chunk (CTRL+Alt+I on Windows, Cmd + Option + I on a Mac). In that chuck, load tidyverse, magrittr, and igraph libraries. Update and load the classdata package.

library(tidyverse)
library(magrittr)
library(igraph)

library(devtools)
install_github("ochyzh/classdata")
library(classdata)
  1. Load the dataset legnet from the classdata package. Check out the help file to learn about the data.

  2. Transform the data from the long form to a square adjacency matrix.

  3. Make a network plot to visualize the network of co-sponsorships among the 9 legislators using the igraph package. Use the help documentation for the igraph package to choose the most visually pleasing layout for your graph.

  4. What does your graph show?

  5. Knit the RMarkdown file (press the “Knit” button above) and read through the corresponding html file.

For the submission: submit your solution in an R Markdown file and (just for insurance) submit the corresponding html file with it.