简体   繁体   中英

Roxygen2 documentation parameter out of order

I'm using Roxygen2 for documentation and I cannot get the order of parameters to be right. Specifically, I have 3 sets of parameters for this one set of methods:

  • "n": A parameter of all functions that should always be first
  • "r": A parameter of some functions that should always be second. In a template
  • p3-p5: A set of parameters from template; should always be at end.
    • These start with "s", "a", and "r", respectively

I have not been able to get it into proper order: The most common order is n, p3-p5, r. If I remove n, I get p3-p5, r. If I have 2 n's, I get n, p3-p5, n, r. If I have 2 r's and no n's, I get p3-p5, r, r.

Any advice on how to fix this. If you think it has to do with the current layout, it's:

#' @templateVar ... ...
#' @param n ...
#' @template t1 # Template for r
#' @template t2 # Template for p3-p5
#' @details  ... 
#' ...

where t2's layout is:

#' @param p3
#' @param p4
#' @param p5
#' @details ...
#' @return  ...
#' ...

Other fixes for this I have found do not seem to work. Also, I would love for n to be part of the t2 template, but I assume that's unreasonable.

Well, congratulate me, because I spend a good 45 minutes trying to figure this out without realizing that the parameters are ordered to sync with the function usage parameter, and r was not supposed to be there anyways.

Fix ended up being that "r" (or the parameter that "r" stands for) did not directly match any of the parameters of the function, so it got thrown to the end. I feel stupid. Whatever, though. Maybe this will be a good warning for future users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM