[ESS] Working with Roxygen2
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Wed Jun 28 03:37:02 CEST 2023
On 28 June 2023 at 06:49, Vikas Rawal via ESS-help wrote:
| I am trying to build my first R package, and am using Roxygen2 to document
| the functions. I was wondering if there is anything that would provide a
| boilerplate template? Maybe a yasnippet or something better?
There is and AFAIK always has been.
I.e. when I open a new file /tmp/pyth.R and add
pyth <- function(x, y) {
sqrt(x^2 + y^2)
}
and save it, ESS mode offers in menu ESS an entry Roxygen with first option
Generate/Update Template and keyboard shortcut C-c C-o C-o (in my version).
That has been here since _forever_. Invoking it adds this header above
##' .. content for \description{} (no empty lines) ..
##'
##' .. content for \details{} ..
##' @title
##' @param x
##' @param y
##' @return
##' @author Dirk Eddelbuettel
pyth <- function(x, y) {
sqrt(x^2 + y^2)
}
and that is 'Good Enough for Me (TM)'. I can't remember if I had to set an
Emacs variable to have my username come up or if ESS queries my Linux host
but it is all quite nicely done.
Hth, Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the ESS-help
mailing list