No video

Using Roxygen2 to document functions in an R package (CC293)

  Рет қаралды 663

Riffomonas Project

Riffomonas Project

Күн бұрын

Including documentation for the functions in your R package is critical to helping end users use your package. Documenting your code can easily be done using Roxygen2. In this Code Club, Pat uses Roxygen2 syntax to help document the functions in his phylotypr R package. Along the way, he refactors the code to improve the documentation and shows some tricks to improving the utility of the documentation. Documenting code isn't the most fun part of package development, but it's really important! This episode is part of an ongoing effort to develop an R package that implements the naive Bayesian classifier.
If you want to get a physical copy of R Packages: amzn.to/43pMR8L
If you want a free, online version of R packages: r-pkgs.org/
You can find my blog post for this episode at www.riffomonas.org/code_club/....
Check out the GitHub repository at the:
* Beginning of the episode: github.com/riffomonas/phyloty...
* End of the episode: github.com/riffomonas/phyloty...
#rstats #readr #vroom #data.table #read.delim #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 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 riffomonas.org/workshops/
You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: www.riffomonas.org/minimalR/
General data: www.riffomonas.org/generalR/
0:00 Introduction
3:24 Separating functions into different files
7:44 Basics of documenting functions
11:18 Using markdown in documentation
18:33 Inheriting documentation for parameters from other functions
25:31 Formatting multi-paragraph text
28:00 Inserting a "Note" section
29:04 Adding hyper links to documentation
33:25 Inserting a "References" section
36:52 Re-using references across functions
38:26 Checking that package builds correctly

Пікірлер: 11
@PhilippusCesena
@PhilippusCesena Ай бұрын
Great video as always!
@Riffomonas
@Riffomonas Ай бұрын
Thanks Philippus!
@samlawrence4627
@samlawrence4627 2 күн бұрын
Thank you for the video. I just have a question about the @examples section. When I preview the documentation file under the help tab in Rstudio, I see a link that says "Run examples." When I click this link, it takes me to a blank page that says "Example/ not found." When I look at other packages, I can click on this link, and it shows the output given by the examples. Is there something I have to do to get this link to work? Or does this happen after the package is submitted?
@Riffomonas
@Riffomonas 2 күн бұрын
I think that only works on packages already on CRAN
@samlawrence4627
@samlawrence4627 2 күн бұрын
@@Riffomonas Okay, thank you
@djangoworldwide7925
@djangoworldwide7925 Ай бұрын
11:09 will instead of with. Not sure if you fixed it later 23:45 should fix to @returns
@Riffomonas
@Riffomonas Ай бұрын
Thanks! I think I got the @returns after editing the video :) It really doesn't matter if you use @return or @returns, but @returns is the new way of doing things.
@djangoworldwide7925
@djangoworldwide7925 Ай бұрын
I wonder how the process today might look if you're doing something like this with ChatGPT: Providing the function to chatgpt Uploading roxyegn documentation (optional) Asking it to write documentation with the important key headers, including examples. That way you can make sure your wording is the same across functions, as well as argument names. I mean, must provide some context but I bet it can spare a lot of time
@shadyamigo
@shadyamigo Ай бұрын
I’ve used it for this very purpose. It’s very good and saves so much time
@Riffomonas
@Riffomonas Ай бұрын
I'll make a deal with you and all of my other viewers... I promise that I will never intentionally use ChatGPT or its ilk to generate code, documentation, anything on my channel :)
@djangoworldwide7925
@djangoworldwide7925 Ай бұрын
I believe you, seeing how good you recall complex regex ;) ​@@Riffomonas
Adding built in data to an R package (CC294)
31:40
Riffomonas Project
Рет қаралды 524
How to create a vignette for an R package (CC297)
36:31
Riffomonas Project
Рет қаралды 279
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 10 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 34 МЛН
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 29 МЛН
Finding the consensus classification using anonymous functions (CC284)
34:46
Benchmarking R functions for joining data frames (CC292)
34:58
Riffomonas Project
Рет қаралды 785
Benchmarking methods for reading text files in R (CC290)
33:58
Riffomonas Project
Рет қаралды 374
How to create a data only R package with devtools (CC296)
38:08
Riffomonas Project
Рет қаралды 393
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
Incorporating C++ code in an R package with Rcpp and devtools (CC288)
26:30
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 10 МЛН