	<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
  <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-100075448-1', 'auto');
  ga('send', 'pageview');

</script>
  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="Hugo 0.78.0" />

  
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  
  <title>New Package In Development: Snakes &middot; Callum Taylor</title>
  

  
  <link rel="stylesheet" href="https://callumgwtaylor.github.io/blog/css/poole.css">
  <link rel="stylesheet" href="https://callumgwtaylor.github.io/blog/css/syntax.css">
  <link rel="stylesheet" href="https://callumgwtaylor.github.io/blog/css/hyde.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

  
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../../../../apple-touch-icon-144-precomposed.png">
  <link rel="shortcut icon" href="../../../../favicon.png">

  
  <link href="" rel="alternate" type="application/rss+xml" title="Callum Taylor" />
</head>




	<body class="theme-base-0d ">
		<div class="sidebar">
  <div class="container sidebar-sticky">
    <div class="sidebar-about">
      <a href="https://callumgwtaylor.github.io/blog/"><h1>Callum Taylor</h1></a>
      <p class="lead">
      An elegant open source and mobile first theme for <a href="http://hugo.spf13.com">hugo</a> made by <a href="http://twitter.com/mdo">@mdo</a>. Originally made for Jekyll.
      </p>
    </div>

    <ul class="sidebar-nav">
      <li><a href="../../../../">Home</a> </li>
      
        <li><a href="../../../../blog/archive/"> Archive </a></li>
      
        <li><a href="../../../../blog/about/"> Callum Taylor </a></li>
      
        <li><a href="https://github.com/callumgwtaylor"> GitHub </a></li>
      
        <li><a href="https://twitter.com/callumgwt"> Twitter </a></li>
      
    </ul>

    <p>&copy; 2020. All rights reserved. </p>
  </div>
</div>


		<div class="content container">
			<div class="post">
			 	<h1>New Package In Development: Snakes</h1>
			  <span class="post-date">Sat, Jan 27, 2018</span>
			      


<p><em>tl:dr snakes is a package containing data on individual snake species, from the World Health Organization Snake Database. You can get an early version from “devtools::install_github(”callumgwtaylor/snakes“)”</em></p>
<p>Recently for an assignment for my masters I was looking at the global burden of snakebite. Keen to get some pretty diagrams in to distract the reviewers from my terrible writing, I went online to find a resource we could analyse in R. This had worked well enough for previous essays, especially with the existence of <a href="https://data.humdata.org/">The Humanitarian Data Exchange</a>, plus a <a href="http://callumgwtaylor.github.io/hdxr">mini package</a> I’d written for my own purposes to import their data easily.</p>
<p>However after a brief search, the only online resource I could see was the <a href="http://apps.who.int/bloodproducts/snakeantivenoms/database/">WHO Snake and Antivenoms Database</a>. Most organisations are keen to get you to have a delve into what they have, recently I’ve used data from <a href="http://www.start.umd.edu/gtd/contact/">The Global Terrorism Database</a> and the <a href="http://www.emdat.be/database">International Disasters Database</a>. Both required a bit of registration but ultimately sent you a csv download.</p>
<p>The WHO Database however, looked like this: <img src="../../../../data/snakes/who-database-landing.png" /> And once you selected a snake, you got this:</p>
<div class="figure">
<img src="../../../../data/snakes/who-database-naja-naja.png" />

</div>
<p>Now, I really like this set up, there’s a clear layout of information for each snake on their individual page. You get a map and an image, and most importantly, which antivenoms exist. However, if you want to make comparisons between lots of snakes, that becomes a bit more difficult. If you want to explore which snakes don’t have antivenoms, or the global distibution of antivenom producers, or anything else then there’s no straightforward way to do so without a lot of loading individual pages to take information down.</p>
<p>At this point, I realised that me working out how to extract any info would definitely allow me to procrastinate beyond the essay deadline, so I gave up. But I did want to learn how to do some basic scraping if I bumped into a similar issue in the future. Using <a href="https://blog.rstudio.com/2014/11/24/rvest-easy-web-scraping-with-r/">this article on rvest</a>, plus <a href="https://channel9.msdn.com/Events/useR-international-R-User-conferences/useR-International-R-User-2017-Conference/Scraping-data-with-rvest-and-purrr">this talk on purrr and rvest</a>, I’ve downloaded the data for each species of medically important snakes from the WHO database.</p>
<p>Now if you load the <code>snakes</code> package from github you can save yourself the hassle of what I did:</p>
<pre><code>devtools::install_github(&quot;callumgwtaylor/snakes&quot;)
library(snakes)
snake_species &lt;- snakes::snake_species_data</code></pre>
<p><code>snake_species_data</code> will give you:</p>
<div class="figure">
<img src="../../../../data/snakes/snake_snake_species_data.png" />

</div>
<ul>
<li>The Identifier the WHO uses for the snake species</li>
<li>Snake Common Name</li>
<li>Snake Species Name</li>
<li>Snake Family</li>
<li>A link to the WHO map of snake distribution</li>
<li>A link to the legend for the WHO map</li>
<li>A link to a WHO picture of the snake</li>
<li>The first other common name for the snake</li>
<li>Any other common names for the snake</li>
<li>Any previous names for the snake</li>
<li>A nested data_frame, containing the regions and subregions the snake is found in</li>
<li>A nested data_frame, containing the snake antivenom product names, manufacturers, and countries of origin</li>
</ul>
<p>This is the first version of the package containing what I’ve put together today. I hope to update it with some more useful geographical information. The database does have individual country pages, so a data_frame including snakes in each country is the next target.</p>
<p><em>Lastly, this is clearly not my data and I make no claims of ownership whatsover. The WHO are the copyright holders for any data, and whilst I think this package comes under acceptable use for research, please let me know if you’re someone from the WHO who disagrees.</em></p>
<p><em>Actually lastly, this data is extracted from the WHO database, but I am not making any claims about their accuracy, so this information should not be used to make any clinical decision on use of antivenom, or any similar decisions</em></p>

			</div>

			
		</div>
  </body>
</html>
