|
1 | 1 | # The README file {#readme} |
2 | 2 |
|
3 | | -README files are not required of Bioconductor packages. |
4 | | - |
5 | | -If a `README` file is included in the package or the <i class="fab |
6 | | -fa-github"></i> Github repository and it provides installation instructions, |
7 | | -those instruction should also include |
8 | | -[_Bioconductor_][] installation instructions. See |
9 | | -Bioconductor package installation instructions on any current Bioconductor |
10 | | -package landing page (e.g. `r BiocStyle::Biocpkg("GenomicRanges")`). |
11 | | - |
12 | | -If a `README.Rmd` is provided (rather than `README.md`, or other) those |
13 | | -installation instructions should be in an `eval=FALSE` code chunk. |
14 | | - |
15 | | -Nowhere in the code (<i class="fab fa-r-project"></i> code, man pages, |
16 | | -vignettes, Rmd files) should someone try to install or download system |
17 | | -dependencies, applications, packages, etc. |
18 | | - |
19 | | -Developers can provide instructions to follow but not executed and should assume |
20 | | -all necessary dependencies, applications, or packages are already set up on a |
21 | | -user's system. See also [the INSTALL file](#sysdep) for system dependencies |
22 | | -requirements. |
| 3 | +Bioconductor does not require `README` files in packages but they |
| 4 | +are often useful for newcomers, especially when a package is developed |
| 5 | +on <i class="fab fa-github"></i> GitHub or similar online platforms. |
| 6 | + |
| 7 | +Bioconductor packages with a `README` file should clearly indicate |
| 8 | +[_Bioconductor_][] installation instructions. See the example installation |
| 9 | +instructions for `GenomicRanges`: |
| 10 | + |
| 11 | +```r |
| 12 | +if (!require("BiocManager", quietly = TRUE)) |
| 13 | + install.packages("BiocManager") |
| 14 | + |
| 15 | +BiocManager::install("GenomicRanges") |
| 16 | +``` |
| 17 | + |
| 18 | +As a general rule, files that run <i class="fab fa-r-project"></i> code |
| 19 | +(including `README.Rmd`) should not install packages, download system |
| 20 | +dependencies, or applications. Installation instructions should be in |
| 21 | +an `eval = FALSE` code chunk. |
| 22 | + |
| 23 | +Developers should assume that all necessary dependencies, applications, and |
| 24 | +packages are already installed on the user's system. |
| 25 | + |
| 26 | +**Note**. Packages with external software dependencies should use the |
| 27 | +`SystemRequirements` field in the `DESCRIPTION` file. See also |
| 28 | +[the INSTALL file](#sysdep) for system dependencies requirements. |
| 29 | + |
| 30 | +## Generating the README.md from the main vignette |
| 31 | + |
| 32 | +Optionally, the `README.md` file can be generated from a package's vignette |
| 33 | +via the `README.Rmd`. Using the child document feature in R Markdown, the |
| 34 | +`README.Rmd` can render a vignette and output a `README.md` file. |
| 35 | +Below is an example `README.Rmd` file that renders a vignette (named |
| 36 | +`mainVignette.Rmd`). |
| 37 | + |
| 38 | +```r |
| 39 | +## --- |
| 40 | +## output: github_document |
| 41 | +## --- |
| 42 | +## |
| 43 | +## ```{r, child="../../vignettes/mainVignette.Rmd"} |
| 44 | +## ``` |
| 45 | +``` |
| 46 | + |
| 47 | +The developer can then generate the `README.md` file by running |
| 48 | +`rmarkdown::render` as: |
| 49 | + |
| 50 | +```r |
| 51 | +rmarkdown::render("inst/scripts/README.Rmd", output_dir = ".") |
| 52 | +``` |
| 53 | + |
0 commit comments