The purpose of this homework is to familiarize yourself with calculating degree, closeness, and betweenness centrality scores as well as centralization scores for undirected and directed networks in R.
In Parts I and II of this homework we will use two new networks (described below). In Part III, you will use the two networks you created from Homework 1 and Homework 2.
For this part of the homework you will use data from Thomas
Grund and James Densley’s study of ties among members of an
inner-city gang in London, England. The network is undirected, binary
ties collected from anonymized arrests data. We will refer to this
network as the LondonGangNet
. Note that the object is of
class network
. To coerce the object to be an object of
class matrix
, use the as.matrix()
function.
For the LondonGangNet
network, do the following:
gplot()
function
where each plot sizes the nodes by the centrality score (i.e. a plot for
degree centrality, a plot for closeness centrality, and a plot for
betweenness centrality).For this part of the homework you will use data from Mangia
Natarajan’s study of a large cocaine trafficking organization in New
York City. The network is directed, binary ties of communication between
individuals collected from police wiretaps of 151 telephone
conversations. We will refer to this network as the
CocaineDealingNet
. Note that the object is of class
network
. To coerce the object to be an object of class
matrix
, use the as.matrix()
function.
For the CocaineDealingNet
network, do the following:
gplot()
function
where each plot sizes the nodes by the centrality score (i.e. a plot for
indegree centrality, a plot for outdegree centrality, a plot for
closeness centrality, and a plot for betweenness centrality).Pick one of your networks from Homework 1 and Homework 2 and do the following:
If the network is undirected, repeat the steps in Part I.
If the network is directed, repeat the steps in Part II.
Download the Homework 3 template prior to beginning. The template contains code for accessing the data files.
When you have completed your homework, click the “Knit” button to
render your .RMD
file into a .HTML
report.
Upload both your .RMD
and .HTML
files to
the appropriate assignment on the Canvas page for this course. Just
click the “Start Assignment” button to upload the files. This assignment
is DUE on 2/21.
Remember to ensure the following before submitting your assignment.
See Google’s R Style Guide for examples of common conventions.
.RMD
files are knit into .HTML
and other
formats procedural, or line-by-line.
install.packages()
or
setwd()
are bound to cause errors in knittinglibrary()
in a previous chunkIf 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.