Using Lintr and Styler to Improve the Quality and Readability of R Code (CC300)

Using Lintr and Styler to Improve the Quality and Readability of R Code (CC300)

HomeRiffomonas ProjectUsing Lintr and Styler to Improve the Quality and Readability of R Code (CC300)
Using Lintr and Styler to Improve the Quality and Readability of R Code (CC300)
ChannelPublish DateThumbnail & View CountDownload Video
Channel AvatarPublish Date not found Thumbnail
0 Views
The tidyverse style guide is a popular set of rules that you can apply to R code to improve the readability and quality of your code. Fortunately, the lintr package can scan our code (it's a /"linter/") to see where we might have violated some of these rules, and the styler package can fix many of these violations. I'll show you how to use these tools to pass the linter. I'll then show you how to include the linter in a GitHub Action to lint our R code when we push code to GitHub. This episode is part of an ongoing effort to develop an R package that implements the naive Bayesian classifier for classifying 16S rRNA gene sequences.

If you want a physical copy of R Packages: https://amzn.to/43pMR8L
If you want a free online version of R packages: https://r-pkgs.org/

My blog post for this episode can be found at https://www.riffomonas.org/code_club/2024-08-26-lintr-styler.

Check out the GitHub repository at:
* Start of episode: https://github.com/riffomonas/phylotypr/tree/bc86d58e9755af9bbfd740be92ca9670b6f024e3
* End of episode: https://github.com/riffomonas/phylotypr/tree/508b51c1fe6748899feec1a178b5f162d2b26c9c

#rstats #usethis #pkgdown #devtools #rdp #16S #classification #classifier #microbialecology #microbiome

Support Riffomonas by joining Patreon!
https://www.patreon.com/riffomonas

Want to practice more of the concepts covered in Code Club? Sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you are interested in purchasing a video workshop, please visit https://riffomonas.org/workshops/

You can also find complete tutorials to learn R with the tidyverse using…
Microbial ecology data: https://www.riffomonas.org/minimalR/
General information: https://www.riffomonas.org/generalR/

0:00 Introduction
5:57 Introduction to using {lintr}
10:35 Adjust lint
16:10 Making exceptions to the linter
19:11 Using RStudio's {lintr} Addin
20:16 Automated restyling with {styler}
24:53 How to ignore a linter for a code block
25:59 How do you ignore a linter for a file or folder?
28:20 Using GitHub Actions to Apply Linter to a Push
29:26 Oops! I forgot to document and build first
30:45 Back to GitHub actions…

Please feel free to share this video with your friends and family if you found it useful.