Questions tagged [roxygen]

Roxygen is an in-source documentation system for R. It is based on Doxygen, and is an alternative to creating .Rd files, in that it automatically creates the package's .Rd files from the in-source documentation.

Roxygen is an in-source documentation system for R. It is based on Doxygen, and is an alternative to creating .Rd files, in that it automatically creates the package's .Rd files from the in-source documentation.

The first sentence of any Roxygen block briefly describes its object; and may be followed directly by a Roxygen tag or a more detailed description .

The detailed description begins after the intervening blank line, and continues until the first Roxygen tag .

Each Roxygen tag begins with an ampersand, like @name, @author, etc.; which means, incidentally, that all real ampersands have to be escaped with a double-ampersand.

Availability

Roxigen was hosted on http://roxygen.org/ until 2018. See it on the Wayback Machine at https://web.archive.org/web/20180809105527/http://roxygen.org/.

135 questions
97
votes
1 answer

Arbitrary sections in roxygen docs

The way Roxygen seems to work is that the first line is the \title, everything else is in the \details, and then any @foo directives handle those things. But R documentation is richer than that. I can have "\section{Llamas}{Are they ungulates?}" in…
Spacedman
  • 92,590
  • 12
  • 140
  • 224
65
votes
3 answers

How can I document data sets with roxygen?

Is it possible to include .R files in the data directory of my package in the roxygen process? I have put several .R files in the data directory. When they are sourced with data(), they read in raw data files and perform some transformations.
Karsten W.
  • 17,826
  • 11
  • 69
  • 103
60
votes
2 answers

When documenting in Roxygen: How do I make an itemized list in @details?

What is the appropriate syntax to add an itemized list to roxygen2, for instance, in the @details section? Can I create a latex list environment? It seems that line breaks are simply ignored, i.e. #' @details text describing parameter inputs in…
cboettig
  • 12,377
  • 13
  • 70
  • 113
60
votes
2 answers

Multiple functions in one .Rd file

Short version: Can I emulate the documentation of Normal in package stats using roxygen? Long version: I'm working on a package and was trying make the documentation more readable by having a number of functions with common inputs/parameters…
dardisco
  • 5,086
  • 2
  • 39
  • 54
56
votes
2 answers

Roxygen2 - how to properly document S3 methods

I've read the Roxygen2 PDF and this site, and I'm lost on the difference between @method @S3method @export and how to use these to properly document S3 methods. I worked up the follow example for discussion: How would I properly document these? How…
Suraj
  • 35,905
  • 47
  • 139
  • 250
49
votes
1 answer

Does roxygen2 automatically write NAMESPACE directives for "Imports:" packages?

tl;dr version of my question If I want to import packages, do I have to manually write import() directives into my NAMESPACE file? It seems like roxygen2 won't magically do that for me, even if I have them listed as "Imports:" in my…
briandk
  • 6,749
  • 8
  • 36
  • 46
49
votes
3 answers

How to properly document a S3 method of a generic from a different package, using Roxygen?

I am writing a package that defines a new class, surveyor, and a print method for this, i.e. print.surveyor. My code works fine and I use roxygen for inline documentation. But R CMD check issues a warning: Functions/methods with usage in …
Andrie
  • 176,377
  • 47
  • 447
  • 496
43
votes
4 answers

Are there best/recommended practices to follow when renaming functions in a new version of a package?

I'm updating an old package and shortening a bunch of really long function names. How do I let a user know the the old function has been deprecated? I document everything with roxygen2 so I'm wondering if #' @alias is what I should use? Thoughts?
Maiasaura
  • 32,226
  • 27
  • 104
  • 108
42
votes
4 answers

Can RStudio automatically generate an roxygen template for a function?

Does RStudio support any automated roxygen template creation? In Emacs-ESS, C-x C-o will produce an roxygen template for a function. For example, it will automagically convert this: foo <- function(x,y) x+y into this: ##' .. content for…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
40
votes
2 answers

When writing my own R package, I can't seem to get other packages to import correctly

Alright, first attempt at writing an R package and I'm stuck. Here's how I create the package: package.skeleton("pkg",code_files=some.filenames) roxygenize("okg") I'm using roxygen2 and have the following imports in my "pkg-package.R" file: @import…
ugh
  • 769
  • 2
  • 6
  • 6
34
votes
2 answers

Is it possible to use R package data in testthat tests or run_examples()?

I'm working on developing an R package, using devtools, testthat, and roxygen2. I have a couple of data sets in the data folder (foo.txt and bar.csv). My file structure looks like this: / mypackage / data * foo.txt, bar.csv / inst …
ldecicco
  • 883
  • 8
  • 16
34
votes
1 answer

How to `\link{}` to a specific section of an Rd file with Roxygen2?

Say I want to link to the "Details" section of my documentation for function foo, what do I do? \link{foo:Details} doesn't appear to work, so what is the right command?
mchen
  • 9,808
  • 17
  • 72
  • 125
33
votes
1 answer

How should I handle 'helper' functions in an R package?

Background I written an R package, and now a collaborator (recent CS grad who is new to R) is editing and refactoring the code. In the process, he is dividing up my functions into smaller, more generic functions. What he is doing makes sense, but…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
30
votes
1 answer

Using Roxygen2 Template tags

Could someone provide an example of how to properly use the Template Tags in Roxygen2. I have tried to do the most obvious thing (to me): In my packageName-package.R file: #' [... other Roxygen blocks ...] #' #' @templateVar testTemplateTag…
politicalEconomist
  • 1,041
  • 1
  • 14
  • 19
26
votes
2 answers

Using source subdirectories within R packages with roxygen2

I would like to use a directory structure within the R folder for the source code of a package. For example, within my R folder I have an algos folder with functions I want to export and document. However roxygen2 by default does not seem to go…
tlamadon
  • 970
  • 9
  • 18
1
2 3
8 9