<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/discourse-network-analysis-undertaking-literature-reviews-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://lucidmanager.org/discourse-network-analysis-literature-review/"> The Devil is in the Data – The Lucid Manager</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Literature reviews are the cornerstone of science. Keeping abreast of developments within any given field of enquiry has become increasingly difficult given the enormous amounts of new research. Databases and search technology have made finding relevant literature easy but, keeping a coherent overview of the discourse within a field of enquiry is an ever more encompassing task.</p>
<p>Scholars have proposed many approaches to analysing literature, which can be placed along a continuum from traditional narrative methods to systematic analytic syntheses of text using machine learning. Traditional reviews are biased because they rely entirely on the interpretation of the researcher. Analytical approaches follow a process that is more like scientific experimentation. These systematic methods are reproducible in the way literature is searched and collated but still rely on subjective interpretation.</p>
<p>Machine learning provides new methods to analyse large swaths of text. Although these methods sound exciting, these methods are incapable of providing insight. Machine learning cannot interpret a text; it can only summarise and structure a corpus. Machine learning still requires human interpretation to make sense of the information.</p>
<p>This article introduces a mixed-method technique for reviewing literature, combining qualitative and quantitative methods. I used this method to analyse literature published by the International Water Association as part of my dissertation into <a rel="nofollow" href="https://lucidmanager.org/invisible-water-utility/" target="_blank">water utility marketing</a>. You can read the code below, or download it from <a rel="nofollow" href="https://github.com/pprevos/r.prevos.net/tree/master/Miscellaneous/LiteratureReview" target="_blank">GitHub</a>. Detailed infromation about the methodology is available through <a rel="nofollow" href="https://doi.org/10.26181/5bd90ca36da85" target="_blank">FigShare</a>.</p>
<h2>A literature review with RQDA</h2>
<p>The purpose of this review was to ascertain the relevance of marketing theory to the discourse of literature in water management. This analysis uses a sample of 244 journal abstracts, each of which was coded with the <a rel="nofollow" href="http://rqda.r-forge.r-project.org/" target="_blank">RQDA</a> library. This library provides functionality for <a rel="nofollow" href="https://lucidmanager.org/qualitative-data-science/" target="_blank">qualitative data analysis</a>. RQDA provides a graphical user interface to mark sections of text and assign them to a code, as shown below.</p>
<figure class="wp-caption"><a rel="nofollow" href="https://lucidmanager.org/?attachment_id=7442" target="_blank"><img data-orig-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/rqda_abstract.png?fit=1059%2C462&amp;ssl=1" data-orig-size="1059,462" data-medium-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/rqda_abstract.png?fit=300%2C131&amp;ssl=1" data-attachment-id="7442" data-image-meta="{" data-image-description="" src="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/rqda_abstract.png?resize=525%2C229&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/rqda_abstract/" data-large-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/rqda_abstract.png?fit=525%2C229&amp;ssl=1" alt="Literature Review with RQDA" data-image-title="rqda_abstract" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" width="450" data-comments-opened="1" class="wp-image-7442" data-recalc-dims="1"></a><figcaption class="wp-caption-text">Marking topics in an abstract with RQDA.</figcaption></figure>
<p>You can load a corpus of text into RQDA and mark each of the texts with a series of codes. The texts and the codes are stored in an SQLite database, which can be easily queried for further analysis.</p>
<p><iframe allowfullscreen="true" src="https://www.youtube.com/embed/TodbCCbV6Wc?version=3&rel=1&%23038;fs=1&%23038;autohide=2&%23038;showsearch=0&%23038;showinfo=1&%23038;iv_load_policy=1&%23038;wmode=transparent" width="450" type="text/html"></iframe></p>
<p>I used a marketing dictionary to assess the abstracts from journals published by the International Water Association from the perspective of marketing. This phase resulted in a database with 244 abstracts and their associated coding.</p>
<h2>Discourse Network Analysis</h2>
<p>Once all abstracts are coded, we can start analysing the internal structure of the IWA literature. First, let’s have a look at the occurrence of the topics identified for the corpus of abstracts.</p>
<p>The first lines in this snippet call the tidyverse and RQDA libraries and open the abstracts database. The </p>
<pre>getCodingTable</pre>
<p> function provides a data frame with each of the marked topics and their location.  This function allows us to visualise the occurrence of the topics in the literature.</p>

<pre>library(tidyverse)
library(RQDA)
## Open project
openProject(&quot;IWA_Abstracts.rqda&quot;, updateGUI = TRUE)

## Visualise codes
getCodingTable() %>%
    group_by(codename) %>%
    count() %>%
    arrange(n) %>%
    ungroup() %>%
    mutate(codename = factor(codename, levels = codename)) %>%
    ggplot(aes(codename, n)) +
        geom_col() +
        coord_flip() +
        xlab(&quot;Code name&quot;) + ylab(&quot;Occurence&quot;)</pre>

<figure class="wp-caption"><img data-orig-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/code_frequencies.png?fit=1048%2C1048&amp;ssl=1" data-orig-size="1048,1048" data-medium-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/code_frequencies.png?fit=300%2C300&amp;ssl=1" data-attachment-id="7443" data-image-meta="{" data-image-description="" src="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/code_frequencies.png?resize=525%2C525&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/code_frequencies/" data-large-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/code_frequencies.png?fit=525%2C525&amp;ssl=1" alt="Frequencies of topics in IWA literature." data-image-title="code_frequencies" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" width="450" data-comments-opened="1" class="wp-image-7443" data-recalc-dims="1"><figcaption class="wp-caption-text">Frequencies of topics in IWA literature.</figcaption></figure>
<p>This bar chart tells us that the literature is preoccupied with asset management and the quality of the product (water) or the service (customer perception). This insight is interesting, but not very enlightening information. We can use discourse network analysis to find a deeper structure in the literature.</p>
<h2>Discourse Network Analysis</h2>
<p>We can view each abstract with two or more topics as a network where each topic is connected. The example below shows four abstracts with two or more codes and their internal networks.</p>
<figure class="wp-caption"><img data-orig-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/complete_graphs.png?fit=1992%2C659&amp;ssl=1" data-orig-size="1992,659" data-medium-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/complete_graphs.png?fit=300%2C99&amp;ssl=1" data-attachment-id="7444" data-image-meta="{" data-image-description="" src="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/complete_graphs.png?resize=525%2C174&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/complete_graphs/" data-large-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/complete_graphs.png?fit=525%2C174&amp;ssl=1" alt="Examples of complete networks for four abstracts." data-image-title="complete_graphs" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" width="450" data-comments-opened="1" class="wp-image-7444" data-recalc-dims="1"><figcaption class="wp-caption-text">Examples of complete networks for four abstracts.</figcaption></figure>
<p>The union of these four networks forms a more extensive network that allows us to analyse the structure of the corpus of literature, shown below.</p>
<figure class="wp-caption"><img data-orig-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/mix_example.communities.png?fit=2000%2C1699&amp;ssl=1" data-orig-size="2000,1699" data-medium-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/mix_example.communities.png?fit=300%2C255&amp;ssl=1" data-attachment-id="7445" data-image-meta="{" data-image-description="" src="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/mix_example.communities.png?resize=525%2C446&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/mix_example-communities/" data-large-file="https://i0.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/mix_example.communities.png?fit=525%2C446&amp;ssl=1" alt="Union of networks and community detection." data-image-title="mix_example.communities" sizes="(max-width: 525px) 100vw, 525px" width="450" data-comments-opened="1" class="wp-image-7445" data-recalc-dims="1"><figcaption class="wp-caption-text">Union of networks and community detection.</figcaption></figure>
<p>We can create a network of topics with the <a rel="nofollow" href="http://igraph.org/r/" target="_blank">igraph package</a>. The first step is to create a <a rel="nofollow" href="https://en.wikipedia.org/wiki/Document-term_matrix" target="_blank">Document-Term-Matrix</a>. This matrix counts how often a topic occurs within each abstract. From this matrix, we can create a graph by transforming it into an <a rel="nofollow" href="https://en.wikipedia.org/wiki/Adjacency_matrix" target="_blank">Adjacency Matrix</a>. This matrix describes the graph which can be visualised and analysed. For more detailed information about this method, refer to <a rel="nofollow" href="http://hdl.handle.net/1959.9/561679" target="_blank">my dissertation</a>.</p>

<pre>library(igraph)
library(reshape2)
dtm &lt;- getCodingTable()[,c(5, 4)] %>%
    mutate(freq = 1) %>%
    acast(filename ~ codename, sum)
adj &lt;- crossprod(dtm)
g &lt;- graph.adjacency(adj, weighted = T, mode = &quot;undirected&quot;)
g &lt;- simplify(g)
## Network Graphs
V(g)$name &lt;- gsub(&quot; &quot;, &quot;\n&quot;, V(g)$name)
par(mar = rep(0, 4))
plot(g,
     layout = layout.fruchterman.reingold,
     vertex.label.cex = 1,
     vertex.size = degree(g),
     vertex.label.color = &quot;black&quot;,
     vertex.frame.color = &quot;white&quot;,
     vertex.color = &quot;Dodgerblue&quot;,
     edge.width = E(g)$weight * 1,
     edge.color = &quot;darkgray&quot;
)</pre>

<figure class="wp-caption"><img data-orig-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_network.png?fit=941%2C885&amp;ssl=1" data-orig-size="941,885" data-medium-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_network.png?fit=300%2C282&amp;ssl=1" data-attachment-id="7448" data-image-meta="{" data-image-description="" src="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_network.png?resize=525%2C494&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/iwa_network/" data-large-file="https://i1.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_network.png?fit=525%2C494&amp;ssl=1" alt="Network of topics in IWA literature." data-image-title="iwa_network" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" width="450" data-comments-opened="1" class="wp-image-7448" data-recalc-dims="1"><figcaption class="wp-caption-text">The network of topics in IWA literature.</figcaption></figure>
<p>In this graph, each node is a topic in the literature, and each edge implies that a topic is used in the same abstract. This graph uses the Fruchterman-Reingold algorithm to position each of the nodes, with the most connected topic in the centre.</p>
<p>The last step is to identify the structure of this graph using community detection. A community is a group of nodes that are more connected with each other than with nodes outside the community.</p>

<pre>set.seed(123)
comms &lt;- spinglass.community(g, spins = 100)
par(mar = rep(0, 4))
plot(comms, g,
     layout = layout.fruchterman.reingold,
     vertex.label.cex = .7,
     vertex.size = degree(g),
     vertex.label.color = &quot;black&quot;,
     vertex.frame.color = NA,
     edge.color = &quot;black&quot;,
     vertex.label.family = &quot;sanserif&quot;,
     mark.border = NA
)</pre>

<figure class="wp-caption"><img data-orig-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_communities.png?fit=922%2C933&amp;ssl=1" data-orig-size="922,933" data-medium-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_communities.png?fit=296%2C300&amp;ssl=1" data-attachment-id="7449" data-image-meta="{" data-image-description="" src="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_communities.png?resize=525%2C531&ssl=1" data-permalink="https://lucidmanager.org/discourse-network-analysis-literature-review/iwa_communities/" data-large-file="https://i2.wp.com/lucidmanager.org/wp-content/blogs.dir/4/files/sites/4/2018/11/iwa_communities.png?fit=525%2C531&amp;ssl=1" alt="Community detection in IWA literature" data-image-title="iwa_communities" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" width="450" data-comments-opened="1" class="wp-image-7449" data-recalc-dims="1"><figcaption class="wp-caption-text">Community detection in IWA literature.</figcaption></figure>
<p>We have now succeeded to convert a corpus of 244 journal abstracts to a parsimonious overview of four communities of topics. This analysis resulted in greater insight into how marketing theory applies to water management, which was used to structure a book about <a rel="nofollow" href="https://www.iwapublishing.com/books/9781780408668/customer-experience-management-water-utilities-marketing-urban-water-supply" target="_blank">water utility marketing</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://lucidmanager.org/discourse-network-analysis-literature-review/"> The Devil is in the Data – The Lucid Manager</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/TOU6Cabbhks" height="1"></a></div>