<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/analyzing-nethack-data-part-1-what-kills-the-players/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.brodrigues.co/blog/2018-11-03-nethack_analysis/"> Econometrics and Free Software</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p><a rel="nofollow" href="https://www.youtube.com/watch?v=dpM2o4dRLto" target="_blank"><br>
<img title="Click here to listen to epic music while reading" src="https://i1.wp.com/www.brodrigues.co/blog/2018-11-03-nethack_analysis/img/deepfried_loss.png?w=456" data-recalc-dims="1"></a></p>
</div>
<div>
<h2>Abstract</h2>
<p>In this post, I will analyse the data I scraped and put into an R package, which I called <code>{nethack}</code>.<br>
NetHack is a roguelike game; for more context, read my previous blog<br>
<a rel="nofollow" href="https://www.brodrigues.co/blog/2018-11-01-nethack/" target="_blank">post</a>.<br>
You can install the <code>{nethack}</code> package and play around with the data yourself by installing it from github:</p>
<pre><code>devtools::install_github(&quot;b-rodrigues/nethack&quot;)</code></pre>
<p>And to use it:</p>
<pre><code>library(nethack)
data(&quot;nethack&quot;)</code></pre>
<p>The data contains information on games played from 2001 to 2018; 322485 rows and 14 columns. I<br>
will analyze the data in a future blog post. This post focuses on getting and then sharing the<br>
data. By the way, all the content from the public server I scrape is under the CC BY 4.0 license.</p>
<p>I built the package by using the very useful <code>{devtools}</code> package.</p>
</div>
<div>
<h2>Introduction</h2>
<p>What I want from this first analysis are several, simple things: how many players manage to ascend<br>
(meaning, winning), what monster kills most players, and finally extract data from the <code>dumplog</code><br>
column. The <code>dumplog</code> column is a bit special; each element of the dumplog column is a log file<br>
that contains a lot of information from the last turns of a player. I will leave this for a future<br>
blog post, though.</p>
<p>Let’s load some packages first:</p>
<pre><code>library(nethack)
library(tidyverse)
library(lubridate)
library(magrittr)
library(brotools)</code></pre>
<p><code>{brotools}</code> is my own package that contains some functions that I use daily. If you want to<br>
install it, run the following line:</p>
<pre><code>devtools::install_github(&quot;b-rodrigues/brotools&quot;)</code></pre>
<p>The documentation is not up-to-date, I think I’ll do that and release it on CRAN. Some day.</p>
<p>Now, let’s load the “nethack” data, included in the <code>{nethack}</code> package:</p>
<pre><code>data(&quot;nethack&quot;)

head(nethack)</code></pre>
<pre><code>##   rank score     name time turns lev_max hp_max role race gender alignment
## 1    1   360      jkm </code></pre></div>