-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathindex.html
230 lines (207 loc) · 16.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Generate your Rd documentation, NAMESPACE file, and collation field using specially formatted comments. Writing documentation in-line with code makes it easier to keep your documentation up-to-date as your requirements change. roxygen2 is inspired by the Doxygen system for C++.">
<title>In-Line Documentation for R • roxygen2</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png">
<script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/Source_Sans_Pro-0.4.9/font.css" rel="stylesheet">
<link href="deps/Source_Code_Pro-0.4.9/font.css" rel="stylesheet">
<!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/[email protected]/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js" integrity="sha512-7O5pXpc0oCRrxk8RUfDYFgn0nO1t+jLuIOQdOMRp4APB7uZ4vSjspzp5y6YDtDs4VzUSTbWzBFZ/LKJhnyFOKw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="pkgdown.js"></script><meta property="og:title" content="In-Line Documentation for R">
<meta property="og:description" content="Generate your Rd documentation, NAMESPACE file, and collation field using specially formatted comments. Writing documentation in-line with code makes it easier to keep your documentation up-to-date as your requirements change. roxygen2 is inspired by the Doxygen system for C++.">
<meta property="og:image" content="https://roxygen2.r-lib.org/logo.png">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--><script defer data-domain="roxygen2.r-lib.org,all.tidyverse.org" src="https://plausible.io/js/plausible.js"></script>
</head>
<body>
<a href="#container" class="visually-hidden-focusable">Skip to content</a>
<nav class="navbar fixed-top navbar-light navbar-expand-lg bg-none" data-bs-theme="light"><div class="container">
<a class="navbar-brand me-2" href="index.html">roxygen2</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">7.3.2</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="articles/roxygen2.html">Get started</a>
</li>
<li class="nav-item">
<a class="nav-link" href="reference/index.html">Reference</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
<div class="dropdown-menu" aria-labelledby="dropdown-articles">
<h6 class="dropdown-header" data-toc-skip>Documentation</h6>
<a class="dropdown-item" href="articles/rd.html">Documenting functions</a>
<a class="dropdown-item" href="articles/rd-other.html">Documenting other objects</a>
<a class="dropdown-item" href="articles/reuse.html">Reusing documentation</a>
<a class="dropdown-item" href="articles/index-crossref.html">Indexing and cross-references</a>
<a class="dropdown-item" href="articles/rd-formatting.html">(R)Markdown support</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header" data-toc-skip>NAMESPACE</h6>
<a class="dropdown-item" href="articles/namespace.html">Managing imports and exports</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header" data-toc-skip>Developer</h6>
<a class="dropdown-item" href="articles/extending.html">Extending roxygen2</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-news">News</a>
<div class="dropdown-menu" aria-labelledby="dropdown-news">
<h6 class="dropdown-header" data-toc-skip>Releases</h6>
<a class="external-link dropdown-item" href="https://www.tidyverse.org/blog/2024/01/roxygen2-7-3-0/">Version 7.3.0</a>
<a class="external-link dropdown-item" href="https://www.tidyverse.org/blog/2022/05/roxygen2-7-2-0/">Version 7.2.0</a>
<a class="external-link dropdown-item" href="https://www.tidyverse.org/blog/2020/03/roxygen2-7-1-0/">Version 7.1.0</a>
<a class="external-link dropdown-item" href="https://www.tidyverse.org/blog/2019/11/roxygen2-7-0-0/">Version 7.0.0</a>
<a class="external-link dropdown-item" href="https://blog.rstudio.com/2017/02/01/roxygen2-6-0-0/">Version 6.0.0</a>
<a class="external-link dropdown-item" href="https://blog.rstudio.com/2015/10/29/roxygen2-5-0-0/">Version 5.0.0</a>
<a class="external-link dropdown-item" href="https://blog.rstudio.com/2014/05/19/roxygen2-4-0-1/">Version 4.0.1</a>
<a class="external-link dropdown-item" href="https://blog.rstudio.com/2013/12/09/roxygen2-3-0-0/">Version 3.0.0</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="news/index.html">Changelog</a>
</div>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="search.json" id="search-input" placeholder="Search for" autocomplete="off">
</form>
<ul class="navbar-nav">
<li class="nav-item">
<a class="external-link nav-link" href="https://github.com/r-lib/roxygen2/" aria-label="github">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
</div>
</nav><div class="container template-home" id="container">
<div class="row">
<main id="main" class="col-md-9"><div class="section level1">
<div class="page-header">
<img src="logo.png" class="logo" alt=""><h1 id="roxygen2-">roxygen2
<a class="anchor" aria-label="anchor" href="#roxygen2-"></a>
</h1>
</div>
<!-- badges: start -->
<p>The premise of roxygen2 is simple: describe your functions in comments next to their definitions and roxygen2 will process your source code and comments to automatically generate <code>.Rd</code> files in <code>man/</code>, <code>NAMESPACE</code>, and, if needed, the <code>Collate</code> field in <code>DESCRIPTION</code>.</p>
<div class="section level2">
<h2 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
</h2>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Install roxygen2 from CRAN</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"roxygen2"</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Or the development version from GitHub:</span></span>
<span><span class="co"># install.packages("pak")</span></span>
<span><span class="fu">pak</span><span class="fu">::</span><span class="fu"><a href="https://pak.r-lib.org/reference/pak.html" class="external-link">pak</a></span><span class="op">(</span><span class="st">"r-lib/roxygen2"</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="usage">Usage<a class="anchor" aria-label="anchor" href="#usage"></a>
</h2>
<p>The premise of roxygen2 is simple: describe your functions in comments next to their definitions and roxygen2 will process your source code and comments to produce Rd files in the <code>man/</code> directory. Here’s a <a href="https://stringr.tidyverse.org/reference/str_length.html" class="external-link">simple example</a> from the stringr package:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">#' The length of a string</span></span>
<span><span class="co">#'</span></span>
<span><span class="co">#' Technically this returns the number of "code points", in a string. One</span></span>
<span><span class="co">#' code point usually corresponds to one character, but not always. For example,</span></span>
<span><span class="co">#' an u with a umlaut might be represented as a single character or as the</span></span>
<span><span class="co">#' combination a u and an umlaut.</span></span>
<span><span class="co">#'</span></span>
<span><span class="co">#' @inheritParams str_detect</span></span>
<span><span class="co">#' @return A numeric vector giving number of characters (code points) in each</span></span>
<span><span class="co">#' element of the character vector. Missing string have missing length.</span></span>
<span><span class="co">#' @seealso [stringi::stri_length()] which this function wraps.</span></span>
<span><span class="co">#' @export</span></span>
<span><span class="co">#' @examples</span></span>
<span><span class="co">#' str_length(letters)</span></span>
<span><span class="co">#' str_length(NA)</span></span>
<span><span class="co">#' str_length(factor("abc"))</span></span>
<span><span class="co">#' str_length(c("i", "like", "programming", NA))</span></span>
<span><span class="va">str_length</span> <span class="op"><-</span> <span class="kw">function</span><span class="op">(</span><span class="va">string</span><span class="op">)</span> <span class="op">{</span></span>
<span><span class="op">}</span></span></code></pre></div>
<p>When you <code><a href="reference/roxygenize.html">roxygenise()</a></code> (or <code>devtools::document()</code>) your package these comments will be automatically transformed to the <code>.Rd</code> that R uses to generate the documentation you see when you type <code>?str_length</code>.</p>
</div>
<div class="section level2">
<h2 id="learn-more">Learn more<a class="anchor" aria-label="anchor" href="#learn-more"></a>
</h2>
<p>To get started, first read <code><a href="articles/roxygen2.html">vignette("roxygen2")</a></code>. Then read more about the specific package component that you want to generate:</p>
<ul>
<li><p>Start with <code><a href="articles/rd.html">vignette("rd")</a></code> to learn how document your functions with roxygen2.</p></li>
<li><p><code><a href="articles/rd-other.html">vignette("rd-other")</a></code> discusses how to document other things like datasets, the package itself, and the various pieces used by R’s OOP systems.</p></li>
<li><p><code><a href="articles/rd-formatting.html">vignette("rd-formatting")</a></code> gives the details of roxygen2’s rmarkdown support.</p></li>
<li><p><code><a href="articles/reuse.html">vignette("reuse")</a></code> demonstrates the tools available to reuse documentation in multiple places.</p></li>
<li><p><code><a href="articles/namespace.html">vignette("namespace")</a></code> describes how to generate a <code>NAMESPACE</code> file, how namespacing works in R, and how you can use roxygen2 to be specific about what your package needs and supplies.</p></li>
<li><p>For the <code>Collate</code> field in the <code>DESCRIPTION</code>, see <code>?update_collate()</code>.</p></li>
</ul>
</div>
</div>
</main><aside class="col-md-3"><div class="links">
<h2 data-toc-skip>Links</h2>
<ul class="list-unstyled">
<li><a href="https://cloud.r-project.org/package=roxygen2" class="external-link">View on CRAN</a></li>
<li><a href="https://github.com/r-lib/roxygen2/" class="external-link">Browse source code</a></li>
<li><a href="https://github.com/r-lib/roxygen2/issues" class="external-link">Report a bug</a></li>
<li><a href="https://r-pkgs.org/man.html" class="external-link">Learn more</a></li>
</ul>
</div>
<div class="license">
<h2 data-toc-skip>License</h2>
<ul class="list-unstyled">
<li><a href="LICENSE.html">Full license</a></li>
<li><small><a href="https://opensource.org/licenses/mit-license.php" class="external-link">MIT</a> + file <a href="LICENSE-text.html">LICENSE</a></small></li>
</ul>
</div>
<div class="community">
<h2 data-toc-skip>Community</h2>
<ul class="list-unstyled">
<li><a href="CODE_OF_CONDUCT.html">Code of conduct</a></li>
<li><a href="SUPPORT.html">Getting help</a></li>
</ul>
</div>
<div class="citation">
<h2 data-toc-skip>Citation</h2>
<ul class="list-unstyled">
<li><a href="authors.html#citation">Citing roxygen2</a></li>
</ul>
</div>
<div class="developers">
<h2 data-toc-skip>Developers</h2>
<ul class="list-unstyled">
<li>
<a href="https://hadley.nz" class="external-link">Hadley Wickham</a> <br><small class="roles"> Author, maintainer, copyright holder </small> <a href="https://orcid.org/0000-0003-4757-117X" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>Peter Danenberg <br><small class="roles"> Author, copyright holder </small> </li>
<li>
<a href="https://github.com/gaborcsardi" class="external-link">Gábor Csárdi</a> <br><small class="roles"> Author </small> </li>
<li>Manuel Eugster <br><small class="roles"> Author, copyright holder </small> </li>
<li>
<a href="https://www.posit.co" class="external-link"><img src="https://www.tidyverse.org/posit-logo.svg" alt="Posit" height="16" width="62" style="margin-bottom: 3px;"></a> <br><small class="roles"> Copyright holder, funder </small> </li>
</ul>
</div>
</aside>
</div>
</div>
<footer><div class="container">
<div class="pkgdown-footer-left">
<p>Developed by <a href="https://hadley.nz" class="external-link">Hadley Wickham</a>, Peter Danenberg, <a href="https://github.com/gaborcsardi" class="external-link">Gábor Csárdi</a>, Manuel Eugster, <a href="https://www.posit.co" class="external-link"><img src="https://www.tidyverse.org/posit-logo.svg" alt="Posit" height="16" width="62" style="margin-bottom: 3px;"></a>.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.9.</p>
</div>
</div></footer>
</body>
</html>