Introduction

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


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

Two IMPORTANT points:

  • If you created a bipartite (i.e. two-mode) network in Lab 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.


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.




How to Submit

Download the template for this lab prior to beginning the lab.


Knitting to HTML

When you have completed your assignment, click the “Knit” button to render your .RMD file into a .HTML report.


Special Instructions

Upload both your .RMD and .HTML files to the appropriate link for this assignment on the Canvas page for this course.


Before You Submit

Remember to ensure the following before submitting your assignment.

  1. Name your files using this format: Lab-##-LastName.rmd and Lab-##-LastName.html
  2. Show both the solution for your code and write out your answers in the body text

See Google’s R Style Guide for examples of common conventions.



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.




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