Professional Documents
Culture Documents
Part I. Getting Started
Part I. Getting Started
Part I. Getting Started
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
iii
use_readme_rmd() 20
The End: check() and install() 23
Review 24
2. System Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
devtools, usethis, and You 27
Personal Startup Configuration 28
R Build Toolchain 29
Windows 30
macOS 30
Linux 30
Verify System Prep 30
iv | Table of Contents
check() and R CMD check 60
Workflow 61
Background on R CMD check 62
7. Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Exported Data 100
Preserve the Origin Story of Package Data 102
Documenting Datasets 104
Table of Contents | v
Non-ASCII Characters in Data 104
Internal Data 105
Raw Data File 106
Filepaths 107
pkg_example() Path Helpers 109
Internal State 109
Persistent User Data 112
vi | Table of Contents
Search Path 146
Function Lookup for User Code 146
Function Lookup Inside a Package 148
Attaching Versus Loading 151
Whether to Import or Depend 152
Part V. Documentation
16. Function Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
roxygen2 Basics 234
The Documentation Workflow 234
roxygen2 Comments, Blocks, and Tags 237
Key Markdown Features 239
Title, Description, Details 240
Title 240
Description 242
Details 243
Arguments 243
Multiple Arguments 244
Inheriting Arguments 245
Return Value 246
Examples 248
Contents 249
Leave the World as You Found It 250
Table of Contents | ix
Errors 251
Dependencies and Conditional Execution 252
Intermixing Examples and Text 254
Reusing Documentation 254
Multiple Functions in One Topic 255
Inheriting Documentation 255
Child Documents 256
Help Topic for the Package 256
x | Table of Contents
Linking 288
Index Organization 289
NonVignette Articles 289
Development Mode 290
Table of Contents | xi
Reverse Dependency Checks 330
Revdeps and Breaking Changes 333
Update Comments for CRAN 334
The Submission Process 336
Failure Modes 337
Celebrating Success 338
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341