| Start |
|---|
| Creating and distributing packages This is a compact guide about how to quickly create an R package from your code. Exhaustive documentations will be linked when available and should be read if you want a deeper knowledge of the situation. See Remarks for more resources. The directory where your code stands will be refered as Creation of the documentationThe documentation for your code has to be in a format which is very similar to LaTeX. However, we will use a tool named The full man page for roxygen is available here (opens new window). It is very similar to doxygen. Here is a practical sample about how to document a function with roxygen: And here will be the result (opens new window). It is also recommanded to create a vignette (see the topic Creating vignettes), which is a full guide about your package. Construction of the package skeletonAssuming that your code is written for instance in files Then delete all the files in You should also generate a reference manual from your documentation using Edition of the package properties1. Package descriptionModify If your package depends on others packages, specify them in a field named 2. Optional foldersOnce you launched the skeleton build,
Finalization and buildYou can delete As it is now, your package is ready to be installed. You can install it with To build your package as a source tarball, you need to execute the following command, from a command prompt in Distribution of your packageThrough GithubSimply create a new repository called MyPackage and upload everything in Then anyone can install your package from github with devtools: Through CRANYour package needs to comply to the CRAN Repository Policy (opens new window). Including but not limited to: your package must be cross-platforms (except some very special cases), it should pass the Here is the submission form (opens new window). You must upload the source tarball. |
| Creating vignettes A vignette is a long-form guide to your package. Function documentation is great if you know the name of the function you need, but it’s useless otherwise. A vignette is like a book chapter or an academic paper: it can describe the problem that your package is designed to solve, and then show the reader how to solve it. Vignettes will be created entirely in markdown. Requirements
Vignette creationYou can now edit your vignette at The text in your vignette is formatted as Markdown (opens new window). The only addition to the original Markdown, is a tag that takes R code, runs it, captures the output, and translates it into formatted Markdown: Will display as: Thus, all the packages you will use in your vignettes must be listed as dependencies in Remarks |
Read Article
https://develop.horje.com/learn/1434/reference