Inline R code in R Markdown documents to improve transparency in scientific manuscripts (CC062)
Channel: Riffomonas Project
Date: 2021-01-12

In this episode of Code Club, Pat Schloss demonstrates how you can embed R code into text using R Markdown's inline coding approach. This strategy has been a game changer for Pat's research program and he's sure it will be the same for yours. RMarkdown is a package in R that works with knitr to generate reproducible documents where you can blend code and text.

This episode is part of a larger arc of episodes investigating the sensitivity and specificity of amplicon sequence variants (ASVs), also known as exact sequence variants (ESVs). ASVs are growing in popularity for analyzing microbial communities using 16S rRNA gene sequences. Proponents think that they should supplant operational taxonomic units (OTUs). What do you think? Pat demonstrates these concepts by live coding at the command line interface using GitHub Flow, Make, and RStudio.

0:00 Introduction
2:55 Creating code chunks
5:10 Inserting inline code
6:59 Setting echo=F for code chunks
10:18 Finding extremes in copy numbers
17:56 Calculating ASV rate per genome
23:37 Finding number of operons genomes per species
31:32 Calculating number of ASVs per species
35:37 Adding dependencies to make file
37:48 Conclusion

The accompanying blog post contains the exercises and solutions can be found at http://www.riffomonas.org/code_club/2021-01-12-inline-r-code