How to Document a Function in Your R Package

Function documentation is one of the most important parts of an R package. Here we see how to document functions using so-called roxygen tags. We also use RStudio functionality to automatically enable roxygen documentation and to insert a roxygen skeleton so that we have to remember few details and just fill in our documentation text at the appropriate places. Our example function randomly selects a song from a specified artist from a billboard hot 100s dataset, provided by the billboard package by Mikkel Freltoft Krogsholm. Contact me, e. g. to discuss (online) R workshops / trainings / webinars: LinkedIn:   / wolfriepl   Twitter:   / statistikindd   Xing: https://www.xing.com/profile/Wolf_Riepl Facebook:   / statistikdresden   https://statistik-dresden.de/kontakt R Workshops: https://statistik-dresden.de/r-schulu... Blog (German, translate option): https://statistik-dresden.de/statisti... Playlist: Music chart history    • Music Chart History