Lab 02 - Network Visualization - INSTRUCTIONS
CRJ 507 Social Network Analysis
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 the Working with Networks in R and Basics of Network Visualization tutorials prior to beginning this lab.
Two IMPORTANT points:
If you created a bipartite (i.e. two or more modes) 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 created a multiplex network (i.e. a network with multiple edges sets) in Lab 1 for either network, you will need to make your multiple network a simplex network for this assignment. You could do this a few ways. You could select a single set of edges and discard the others. For example, if you had a network where individuals where connected by either friendship or advice seeking, you could select just the friendship ties. Another way is to keep both sets of ties and just treat them as the same thing.
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:
- Create an adjacency matrix of the network using the
matrix()
function. - Create an object of class
network
. - Plot the network using the
gplot()
function. Modify the plot using at least three arguments in thegplot()
function.
- Describe how each of your modifications helps improve interpretability of the network.
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.
- Name your files using this format: Lab-##-LastName.rmd and Lab-##-LastName.html
- 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()
orsetwd()
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.