Introduction

The purpose of this lab is to familiarize yourself with how networks are created and visualized in R.

In Homework 1 you created two networks. I would like you to continue working with those networks for this homework. Please review Lab 3 - Introduction to Networks in R and Lab 4 - Basics of Network Visualization prior to beginning this lab.

Two IMPORTANT points:

  • If you created a bipartite (i.e. two-mode) network in Homework 1 for either network, you will need to restructure the network to be unipartite for this assignment. But, this is a simple task! All you have to do is figure out which node set you want to connect and create direct connections between them. For example, if Jon and Julio both attended a Wu-Tang Clan concert, then the bipartite graph is: Jon-Event-Julio. That is, Jon and Julio are connected by the event. To make this unipartite, just remove the event such that you simply have: Jon-Julio.

  • If you review the instructions below and you feel like your network is not appropriate for the assignment and need to create a different example…that is fine! We will use these networks throughout the course, so I want to make sure you have something you can work with consistently.

Make sense? If you have questions before you begin, just post an issue to the course help page.


Instructions

For each network you created, do the following:

  1. Create an adjacency matrix of the network and save it as a .csv file.
  2. Import the network into R using the read.csv() function or create the network using the matrix() function.
  3. Create an object of class network.
  4. Plot the network using the gplot() function.
  5. Modify the plot using at least three arguments in the gplot() function.


Using the Template, Knitting, and Submitting

For this homework, you will use a .Rmd template I have created. Download the template for this homework prior to beginning the homework. For all the homework assignments, be sure to show both the solution for your code and write out your answers in the body text (were relevant). When you have completed your assignment, click the “Knit” button to render your .RMD file into a .HTML report.

A physical copy of the assignment must be turned in during class on the corresponding due date. This assignment is DUE on 2/7.


Common Knitting Issues

.RMD files are knit into .HTML and other formats procedural, or line-by-line.

  • An error in code when knitting will halt the process; error messages will tell you the specific line with the error
  • Certain functions like install.packages() or setwd() are bound to cause errors in knitting
  • Altering a dataset or variable in one chunk will affect their use in all later chunks
  • If an object is “not found”, make sure it was created or loaded with library() in a previous chunk

If All Else Fails: If you cannot determine and fix the errors in a code chunk that’s preventing you from knitting your document, add eval = FALSE inside the brackets of {r} at the beginning of a chunk to ensure that R does not attempt to evaluate it, that is: {r eval = FALSE}. This will prevent an erroneous chunk of code from halting the knitting process.




Back to SAND main page


Please report any needed corrections to the Issues page. Thanks!