Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nbenn/roxydocs


https://github.com/nbenn/roxydocs

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# roxydocs

In order to add documentation to [{cpp11}](https://cpp11.r-lib.org) wrapper functions, generated using [`cpp11::cpp_register()`](https://cpp11.r-lib.org/reference/cpp_register.html), this experimental package adds a [{roxygen2}](https://roxygen2.r-lib.org) tag, `@documents`, which can be used to specify one (or several) functions which are associated with an existing block of documentation.

Mimicking the style of documentation where functions with explicit `@rdname` tags are associated with a `NULL`-terminated dummy block as

```{r, eval = FALSE}
#' Basic arithmetic
#'
#' @param a,b numeric vectors.
#' @name arith
NULL

#' @rdname arith
add <- function(a, b) a + b

#' @rdname arith
times <- function(a, b) a * b
```

the `@documents` tag attempts to create identical documentation without having to rely on `@rdname` tags.

```{r, eval = FALSE}
#' Basic arithmetic
#'
#' @param a,b numeric scalars.
#' @name arith
#' @documents add
#' @documents times
NULL

add <- function(a, b) a + b

times <- function(a, b) a * b
```

# Disclaimer

This is not intended for production use, but was only created for exploring options for documenting [{cpp11}](https://cpp11.r-lib.org) wrapper functions.