Writing the documentation for a package
As mentioned, the man
folder contains all the necessary documentation files. It consists of R documentation files, which can be recognized by their file extension Rd
.
Documenting our R code as well as possible is very important. It gives other people the chance to understand our functions and how to actually implement them into their workflow.
After creating the project, this folder contains a basic documentation file for the project in general. The R documentation files are written in the so-called Rd
-format, which is closely related to LaTeX and can be processed into various output formats including HTML or plain text.
Creating Rd documentation files
We have two ways to create an Rd
file:
We can call the
prompt()
function in the R console and send as an argument the function we want to create a documentation file for. So the function callprompt(lm)
would create thelm.Rd
file in our current working directory. We can then move this file to theman
folder...