Using lintr and styler to improve the quality and readability of R code (CC300)

Опубликовано: 26 Август 2024
на канале: Riffomonas Project
1,689
55

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. Thankfully, the lintr package is able to screen our code (it's a "linter") to see where we may have violated some of these rules and the styler package is able to correct many of these violations. I show how to use these tools to pass the linter. Then I show how to incorporate the linter into a GitHub action to lint our R code whenever 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 to get a physical copy of R Packages: https://amzn.to/43pMR8L
If you want a free, online version of R packages: https://r-pkgs.org/

You can find my blog post for this episode at https://www.riffomonas.org/code_club/....

Check out the GitHub repository at the:
Beginning of the episode: https://github.com/riffomonas/phyloty...
End of the episode: https://github.com/riffomonas/phyloty...

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

Support Riffomonas by becoming a Patreon member!
  / riffomonas  

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 purchasing a video workshop be sure to check out 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 Introduction
5:57 Introduction to using {lintr}
10:35 Customizing the linter
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 block of code
25:59 How to ignore a linter for file or directory
28:20 Using GitHub actions to apply linter on a push
29:26 Oops! I forgot to document and build first
30:45 Back to GitHub actions...