In roxygen2, one can use the tag @inheritParams
to inherit the full set of parameters of another function. But is it also possible to inherit only a certain subset of them? (Excluding the case of inheriting ...
, which is adequately handled by @inheritDotParams
.)
Asked
Active
Viewed 3,211 times
26

egnha
- 1,157
- 14
- 22
-
2I think this question is related to this [one](https://stackoverflow.com/questions/47782004/how-to-use-inheritparams-on-single-parameters-when-multiple-parameters-match) and also to this [one](https://stackoverflow.com/questions/42703052/is-it-possible-to-inheritparams-from-a-function-within-another-package). – Maaehj Oct 22 '18 at 14:21
-
1Does this answer your question? [How to use @inheritParams on single parameters when multiple parameters match?](https://stackoverflow.com/questions/47782004/how-to-use-inheritparams-on-single-parameters-when-multiple-parameters-match) – camille Oct 18 '21 at 20:44
1 Answers
22
In the header of functionA
:
@inheritParams functionB
, at least in Roxygen 6.0.0., will only inherit the parameters from functionA
that also are found in functionB
. Any parameters that are shared but that are defined in the functionA
header will not be inherited from functionB
.
So, the selection is built-in.

Ken Benoit
- 14,454
- 27
- 50