Communication and Social Networks (Spring 2020)/Dutch School Data Visualization challenge

From CommunityData

The goal[edit]

In 2003 and 2004, researchers repeatedly surveyed a number of Dutch school students about their friendships and their behavior. They were particularly interested in the relationship between friendships and drinking behavior. They recorded information about alcohol use, gender, age, ethnicity (whether Dutch or not), and religion.

For this homework, you are supposed to think of a question that you could ask about this data. I don't remember exactly the questions that we came up with in class, but you could ask things like:

  • Are people who drink more more popular?
  • Are males or females more likely to have the same drinking behavior as their friends?
  • Are people of the dominant religion more likely to be popular? More likely to be friends with each other?

I created two files to help you to get started:

  1. This link is an R Markdown file that gives general examples of how to create network visualizations, and gives information about the data. Right-click the file, save it to your computer, and open it in RStudio. At the top of RStudio click "knit", and it should open up something that looks kind of like a web page, which was created from this file (video explaining R Markdown).
  2. This R file shows an A+ example of this assignment. It shows how to load the code, gives you visualization ideas, and some code that you might want to alter for your assignment. As with the other one, you should be able to right-click it, save it, and open it in RStudio. I explain the code in this video.

There are lots of different questions that you can ask about this data, and lots of different ways to visualize relationships between them. Your goal is to identify a question that you think would be interesting and to use R to visualize the network in a way that sheds light on that question. In my example, I decided to look at whether friendships which were mutual were more likely to have the same drinking behavior. I ended up coloring the nodes based on drinking behavior and coloring the edges based on whether they had the same drinking behavior.

If you wanted to visualize whether drinkers were more popular, you might color nodes by drinking behavior, and change their size based on their indegree centrality or eigenvector centrality.

The data[edit]

The R Markdown file linked above explains that I created 2 igraph objects for you:

  • G is a multiplex network, which includes both friendships and edges which represent whether two people went to grade school together
  • friend_net is just a simplified version of </G>, where I removed the grade school edges.

In order to load these igraph objects into R you will need to run


This should grab the igraph objects G and friend_net, and load them into your environment. Descriptions of both networks are in the R Markdown file.

Descriptions of what each measure means are at this site, maintained by the people who collected the data.


Note that you may need to install the following packages to get my scripts to work:

install.packages('igraph') install.packages('tidygraph') # Only for the second script

This will install these libraries on your computer, so that you can use them