-
Notifications
You must be signed in to change notification settings - Fork 18
/
debug-rd-links.Rmd
71 lines (49 loc) · 1.92 KB
/
debug-rd-links.Rmd
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
# Debug: Links in Rd files {#man-links}
## Context
This chapter describes an issue resolved on 31-May-2022.
The objective was to include a link from the man page of one package
to the man page of the `SummarizedExperiment` class in the `r BiocStyle::Biocpkg("SummarizedExperiment")` package.
Using `r BiocStyle::CRANpkg("roxygen2")`, the link was written as
follows in the R file:
```
#' ... \linkS4class{SummarizedExperiment} ...
```
The issue was that `rcmdcheck::rcmdcheck()` reported the following WARNING:
```
W checking Rd cross-references (<...>ms)
Missing link or links in documentation object '<...>.Rd':
‘SummarizedExperiment-class’
See section 'Cross-references' in the 'Writing R Extensions' manual.
```
## What worked
First, the `SummarizedExperiment` package was added to the `Depends:` section
of the DESCRIPTION file.
```
Depends:
SummarizedExperiment
```
At that point, `rcmdcheck::rcmdcheck()` dropped the previous WARNING and instead
displayed the following NOTE.
```
N checking dependencies in R code (7.9s)
Package in Depends field not imported from: ‘SummarizedExperiment’
These packages need to be imported from (in the NAMESPACE file)
for when this namespace is loaded but not attached.
```
Then, the following line was added to the R script.
```
#' @import SummarizedExperiment
```
Next, `devtools::document()` was run, adding the following line to the
NAMESPACE file.
```
import(SummarizedExperiment)
```
At which point `rcmdcheck::rcmdcheck()` did not return any more issue.
## What did not work
Adding the `SummarizedExperiment` package to the `Imports:` section of the
DESCRIPTION file, adding an `@import` statement in the documentation, and
running `devtools::document()`.
At that point, `rcmdcheck::rcmdcheck()` continued to display the initial WARNING.
## Additional resources
- [Rd formatting](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html)