---
layout: post
title: "Using the R scan function to read non-rectangular data (CC169)"
blurb: "Reading irregular data into R with scan"
author: "PD Schloss"
date: 2021-12-06 11:00
comments: false
youtube: tg71cJsX7BU
start_hash: b0d55b783e5c84eb26114cd4a722ab027fd77839
end_hash: 40579c347018aaf6d1e603ee4fa65eae87114253
---

The R scan function is key if you need to read in non-rectangular and any irregular shaped data. In this episode, Pat demonstrates scan's arguments to read in a lower triangular phylip-formatted distance matrix. This is part of a series of videos demonstrating how to functions from base R to make these data compatible with tools from the tidyverse

A file with the simple distance matrix can be obtained [here](https://raw.githubusercontent.com/riffomonas/distances/main/mice_simple.braycurtis.dist). The data were generated in our [Kozich et al. 2013 paper](http://doi.org/10.1128/AEM.01043-13) using samples from the [Schloss et al. 2012 paper](http://doi.org/10.4161/gmic.21008).




<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


## Code

You can browse the state of the repository at the
* [beginning of the episode](https://github.com/riffomonas/distances/tree/{{ page.start_hash }})
* [end of the episode](https://github.com/riffomonas/distances/tree/{{ page.end_hash }})
