<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/exploratory-data-analysis-of-ancient-texts-with-rperseus/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ropensci.org/blog/2017/12/05/rperseus/"> rOpenSci - open tools for open science</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h3>Introduction</h3>
<p>When I was in grad school at Emory, I had a favorite desk in the library. The desk wasn’t particularly cozy or private, but what it lacked in comfort it made up for in real estate. My books and I needed room to operate. Students of the ancient world require many tools, and when jumping between commentaries, lexicons, and interlinears, additional clutter is additional “friction”, i.e., lapses in thought due to frustration. Technical solutions to this clutter exist, but the best ones are proprietary and expensive. Furthermore, they are somewhat inflexible, and you may have to shoehorn your thoughts into their framework. More friction.</p>
<p>Interfacing with <a rel="nofollow" href="http://www.perseus.tufts.edu/hopper/" target="_blank">the Perseus Digital Library</a> was a popular online alternative. The library includes a catalog of classical texts, a Greek and Latin lexicon, and a word study tool for appearances and references in other literature. If the university library’s reference copies of BDAG<sup><a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fn:1" target="_blank">1</a></sup> and <em>Synopsis Quattuor Evangeliorum</em><sup><a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fn:2" target="_blank">2</a></sup> were unavailable, Perseus was our next best thing.</p>
<p>Fast forward several years, and I’ve abandoned my quest to become a biblical scholar. Much to my father’s dismay, I’ve learned writing code is more fun than writing exegesis papers. Still, I enjoy dabbling with dead languages, and it was the desire to wed my two loves, biblical studies and R, that birthed my latest package, <code>rperseus</code>. The goal of this package is to furnish classicists with texts of the ancient world and a toolkit to unpack them.</p>
<h3>Exploratory Data Analysis in Biblical Studies</h3>
<p>Working with the Perseus Digital Library was already a trip down memory lane, but here’s an example of how I would have leveraged <code>rperseus</code> many years ago.</p>
<p>My best papers often sprung from the outer margins of my <a rel="nofollow" href="https://en.wikipedia.org/wiki/Novum_Testamentum_Graece" target="_blank"><em>Nestle-Aland Novum Testamentum Graece.</em></a> Here the editors inserted cross references to parallel vocabulary, themes, and even grammatical constructions. Given the intertextuality of biblical literature, the margins are a rich source of questions: Where else does the author use similar vocabulary? How is the source material used differently? Does the literary context affect our interpretation of a particular word? This is exploratory data analysis in biblical studies.</p>
<p>Unfortunately the excitement of your questions is incommensurate with the tedium of the process–EDA continues by flipping back and forth between books, dog-earring pages, and avoiding paper cuts. <code>rperseus</code> aims to streamline this process with two functions: <code>get_perseus_text</code> and <code>perseus_parallel</code>. The former returns a data frame containing the text from any work in the Perseus Digital Library, and the latter renders a parallel in <code>ggplot2</code>.</p>
<p>Suppose I am writing a paper on different expressions of love in Paul’s letters. Naturally, I start in 1 Corinthians 13, the famed “Love Chapter” often heard at weddings and seen on bumper stickers. I finish the chapter and turn to the margins. In the image below, I see references to Colossians 1:4, 1 Thessalonians 1:3, 5:8, Hebrews 10:22-24, and Romans 8:35-39.</p>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-12-05-rperseus/nantg.png?w=456&ssl=1" data-recalc-dims="1"><br>
<em>1 Corinithians 13 in Nestle-Aland Novum Testamentum Graece</em></p>
<p>Ignoring that some scholars exclude Colossians from the “authentic” letters, let’s see the references alongside each other:</p>
<pre><code>library(rperseus) #devtools::install_github(“ropensci/rperseus”)
library(tidyverse)

tribble(
  ~label, ~excerpt,
  &quot;Colossians&quot;, &quot;1.4&quot;,
  &quot;1 Thessalonians&quot;, &quot;1.3&quot;,
  &quot;1 Thessalonians&quot;, &quot;5.8&quot;,
  &quot;Romans&quot;, &quot;8.35-8.39&quot;
  ) %>% 
  left_join(perseus_catalog) %>%
  filter(language == &quot;grc&quot;) %>%
  select(urn, excerpt) %>%
  pmap_df(get_perseus_text) %>%
  perseus_parallel(words_per_row = 4)
</code></pre>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-12-05-rperseus/Parallel1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>A brief explanation: First, I specify the labels and excerpts within a tibble. Second, I join the lazily loaded <code>perseus_catalog</code> onto the data frame. Third, I filter for the Greek<sup><a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fn:3" target="_blank">3</a></sup> and select the columns containing the arguments required for <code>get_perseus_text</code>. Fourth, I map over each urn and excerpt, returning another data frame. Finally, I pipe the output into <code>perseus_parallel</code>.</p>
<p>The key word shared by each passage is <em>agape</em> (“love”). Without going into detail, it might be fruitful to consider the references alongside each other, pondering how the semantic range of <em>agape</em> expands or contracts within the Pauline corpus. Paul had a penchant for appropriating and recasting old ideas–often in slippery and unexpected ways–and your Greek lexicon provides a mere approximation. In other words, how can we move from the dictionary definition of <em>agape</em> towards Paul’s unique vision?</p>
<p>If your Greek is rusty, you can parse each word with <code>parse_excerpt</code> by locating the text’s urn within the <code>perseus_catalog</code> object.</p>
<pre><code>parse_excerpt(urn = &quot;urn:cts:greekLit:tlg0031.tlg012.perseus-grc2&quot;, excerpt = &quot;1.4&quot;)
</code></pre>
<table>
<thead>
<tr>
<th align="left">word</th>
<th align="left">form</th>
<th align="left">verse</th>
<th align="left">part_of_speech</th>
<th align="left">person</th>
<th align="left">number</th>
<th align="left">tense</th>
<th align="left">mood</th>
<th align="left">voice</th>
<th align="left">gender</th>
<th align="left">case</th>
<th align="left">degree</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">ἀκούω</td>
<td align="left">ἀκούσαντες</td>
<td align="left">1.4</td>
<td align="left">verb</td>
<td align="left">NA</td>
<td align="left">plural</td>
<td align="left">aorist</td>
<td align="left">participle</td>
<td align="left">active</td>
<td align="left">masculine</td>
<td align="left">nominative</td>
<td align="left">NA</td>
</tr>
<tr>
<td align="left">ὁ</td>
<td align="left">τὴν</td>
<td align="left">1.4</td>
<td align="left">article</td>
<td align="left">NA</td>
<td align="left">singular</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">feminine</td>
<td align="left">accusative</td>
<td align="left">NA</td>
</tr>
<tr>
<td align="left">πίστις</td>
<td align="left">πίστιν</td>
<td align="left">1.4</td>
<td align="left">noun</td>
<td align="left">NA</td>
<td align="left">singular</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">feminine</td>
<td align="left">accusative</td>
<td align="left">NA</td>
</tr>
<tr>
<td align="left">ὑμός</td>
<td align="left">ὑμῶν</td>
<td align="left">1.4</td>
<td align="left">pronoun</td>
<td align="left">NA</td>
<td align="left">plural</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">NA</td>
<td align="left">masculine</td>
<td align="left">genative</td>
<td align="left">NA</td>
</tr>
</tbody>
</table>
<p>If your Greek is <em>really</em> rusty, you can also flip the <code>language</code> filter to “eng” to view an older English translation.<sup><a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fn:4" target="_blank">4</a></sup> And if the margin references a text from the Old Testament, you can call the Septuagint as well as the original Hebrew.<sup><a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fn:5" target="_blank">5</a></sup></p>
<pre><code>tribble(
  ~label, ~excerpt,
  &quot;Genesis&quot;, &quot;32.31&quot;,
  &quot;Genesis, pointed&quot;, &quot;32.31&quot;,
  &quot;Numeri&quot;, &quot;12.8&quot;,
  &quot;Numbers, pointed&quot;, &quot;12.8&quot;
  ) %>% 
  left_join(perseus_catalog) %>%
  filter(language %in% c(&quot;grc&quot;, &quot;hpt&quot;)) %>%
  select(urn, excerpt) %>%
  pmap_df(get_perseus_text) %>%
  perseus_parallel()
</code></pre>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-12-05-rperseus/Parallel2.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Admittedly, there is some “friction” here in joining the <code>perseus_catalog</code> onto the initial tibble. There is a learning curve with getting acquainted with the idiosyncrasies of the catalog object. A later release will aim to streamline this workflow.</p>
<h3>Future Work</h3>
<p><a rel="nofollow" href="https://ropensci.github.io/rperseus/articles/rperseus-vignette.html" target="_blank">Check the vignette</a> for a more general overview of <code>rperseus</code>. In the meantime, I look forward to getting more intimately acquainted with the Perseus Digital Library. Tentative plans to extend <code>rperseus</code> a Shiny interface to further reduce “friction” and a method of creating a “book” of custom parallels with <code>bookdown</code>.</p>
<h3>Acknowledgements</h3>
<p>I want to thank my two rOpenSci reviewers, <a rel="nofollow" href="https://www.ildiczeller.com/" target="_blank">Ildikó Czeller</a> and <a rel="nofollow" href="https://francoismichonneau.net/" target="_blank">François Michonneau,</a> for coaching me through the review process. They were the first two individuals to ever scrutinize my code, and I was lucky to hear their feedback. rOpenSci onboarding is truly a wonderful process.</p>
<p></p>
<div>
<hr>
<ol>
<li>Bauer, Walter. <em>A Greek-English Lexicon of the New Testament and Other Early Christian Literature.</em> Edited by Frederick W. Danker. 3rd ed. Chicago: University of Chicago Press, 2000.<br>
<a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fnref:1" target="_blank">↩</a></li>
<li>Aland, Kurt. <em>Synopsis Quattuor Evangeliorum.</em> Deutsche Bibelgesellschaft, 1997.<br>
<a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fnref:2" target="_blank">↩</a></li>
<li>The Greek text from the Perseus Digital Library is from 1885 standards. The advancement of textual criticism in the 20th century led to a more stable text you would find in current editions of the Greek New Testament.<br>
<a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fnref:3" target="_blank">↩</a></li>
<li>The English translation is from Rainbow Missions, Inc. <em>World English Bible.</em> Rainbow Missions, Inc.; revision of the American Standard Version of 1901. I’ve toyed with the idea of incorporating more modern translations, but that would require require resources beyond the Perseus Digital Library.<br>
<a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fnref:4" target="_blank">↩</a></li>
<li>“hpt” is the pointed Hebrew text from <em>Codex Leningradensis.</em><br>
<a rel="nofollow" href="https://ropensci.org/blog/2017/12/05/rperseus/#fnref:5" target="_blank">↩</a></li>
</ol>
</div>
	<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://ropensci.org/blog/2017/12/05/rperseus/"> rOpenSci - open tools for open science</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 width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/4eBP6h2-Om0" height="1"></a></div>