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 use functions from base R to make these data compatible with tools from the tidyverse
In this episode, Pat uses #scan in #Rstudio. The accompanying blog post can be found at https://www.riffomonas.org/code_club/2021-12-06-scan.
The simple distance matrix can be obtained at https://raw.githubusercontent.com/riffomonas/distances/refs/heads/main/data/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).
Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.
If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/
You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/
0:00 Reading in non-rectangular data with scan
3:39 The anatomy of a phylip formatted lower triangular distance matrix
4:45 Why read_tsv/read_csv won't work
6:03 Using the scan function