I have the following description file as part of my R package
Package: blah
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("Jon", "Snow", email = "[email protected]", role = c("aut", "cre"))
Description: What the package does (one paragraph).
Depends: R (>= 3.5.1)
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.0.9000
I have documented my code and would like to produce a manual that accompanies it. In a previous post, people have mentioned using the command
R CMD Rd2pdf <work directory>
and I managed to produce a manual.
The issue is that in my manual, the bit before R topics documented does not show the authors but everything else. I have installed packages such as devtools
, knitr
, roxygen2
and testthat
. Any advice would be highly appreciated.
Simply add a file/path argument to your function(s). Write package names, software names, and API names in single quotes in your DESCRIPTION . If you use for example LaTeX in your DESCRIPTION , put it in single quotes.
R packages contain code, data, and documentation in a standardised collection format that can be installed by users of R, typically via a centralised software repository such as CRAN (the Comprehensive R Archive Network).
A dependency is a code that your package needs to run. Dependencies are managed by two files. The DESCRIPTION manages dependencies at the package level; i.e. what packages needs to be installed for your package to work. R has a rich set of ways to describe different types of dependencies.
The NAMESPACE file specifies the functions in the package that are exported to the user, and functions or packages that are imported by the package. Exported functions are functions from our package that are accessible by the user, and imported functions are functions from other packages used by our package.
If you want to include multiple authors, you have to wrap all persons in c()
.
See the DESCRIPTION of sf for example, which looks something like this:
Authors@R:
c(person(given = "Edzer",
family = "Pebesma",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-8049-7069")),
person(given = "Jeroen",
family = "Ooms",
role = "ctb",
comment = c(ORCID = "0000-0002-4035-0289")),
person(given = "Kirill",
family = "Müller",
role = "ctb"))
If there is only one author, you can simply write:
Author: Lax Chan
The Authors@R
field is reformatted as Author
when you build a source package. It won't appear in your source directory, so building the manual from that won't include it.
What you need to do is to build the tar.gz
file from the source, then create the manual from that.
Since it seems you are using command line methods, this is done by
R CMD build <workdir>
which produces something like workdir.version.tar.gz
. Unfortunately, Rd2pdf
can't read this file directly, so you need two more steps. Move to a clean directory, and run
tar zxvf workdir.version.tar.gz
R CMD Rd2pdf workdir
to produce the manual from the built DESCRIPTION file.
(I don't think it would be a disaster if you unpacked the tarball on top of the original source, but it could cause confusion later if you change the DESCRIPTION
file.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With