0

I have a package of functions; one function has 22 parameters (including ...). I've recently moved a parameter from being a ... option to being a full parameter, and noticed that even though it's described in the logical order in the function parameters list, and in the same order in the roxygen2 @params items list, when I document() , the new item is below the ... item at the bottom, and is itself followed by another param which I've got in the logical place too.

Example: Script looks like this:

#' @param ParameterA does something
#' @param ParameterB does something else
#' @param ... optional extras

foo <- function(ParameterA, ParameterB, ...)

Rd & help file look like this:

Arguments

Parameter A    does something
...            optional extras
Parameter B    does something else

I know this is petty but does anyone know how to fix this? I deleted the .Rd file and redocument()ed to no avail.

Imgur album (3 pics) of screenshots here: https://i.stack.imgur.com/VNqG7.jpg

Edit: more digging: I ran build & reload, check, and saw:

Documented arguments not in \usage in documentation object 'gbm.auto':‘tc’ ‘mapshape’.
Functions with \usage entries need to have the appropriate \alias entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.

Last paragraph before "RC" here says @usage no longer required since v3 of roxygen2 generates this automatically. But this isn't working for me any more, despite having worked in the past.

dez93_2000
  • 1,730
  • 2
  • 23
  • 34
  • What exactly are the series of commands you are running? Is this all happening in RStudio? If you can make this problem easily [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) it will be easier to help you – MrFlick Sep 27 '16 at 01:32
  • hi, all Rstudio, yeah. Not easily reproducible, really. As I understand it, if you have your roxgyen2 items in a certain order, document() will push them to the .Rd document in the same order. It may be that my changes are simply not being written somehow. Screenshots added to main question. – dez93_2000 Sep 27 '16 at 01:49
  • The screen shots are not very helpful because they cut off important bits. I'm guessing that the example in your question is not accurate. According to [this code update](https://github.com/krlmlr/roxygen/commit/89e3448b728654d236deb32ba94fc63797a1d3b5) parameter order should be in the order they appear in the order of the function definition formals, not the order in which you list the @param attributes. – MrFlick Sep 27 '16 at 02:06
  • I'm not sure what they cut off that's helpful. Picture 1 is the top of the R script showing the roxygen2 parameters in the correct order. Picture 2 is lower on the same script showing the function definition formats (I think we're talking about the same thing?) in the same - correct - order. Picture 3 is the help pane in Rstudio displaying the html of the Rd file corresponding to the R script, generated using document() only. – dez93_2000 Sep 27 '16 at 15:17
  • It seems that, given the order of my @params & function arguments in the R script, document() should push these to the .Rd file, and commit/push should push these to the github package, and devtools::install_github('SimonDedman/gbm.auto') should download & install the updated package with correct params order in help file & other changes pushed. I'm concerned that the update/push/download isn't happening correctly as other changes to the script look like they might not be working. When I type "gbm.auto" to see the script, it's missing the tc & mapshape params (which come after the ...). – dez93_2000 Sep 27 '16 at 19:10

1 Answers1

0

Found the culprit: another script was in the R folder with the same function within it (essentially a draft/fork of the main function with something I'm trying to change it to). (I assume that) document() was writing the Rd file for gbm.auto from gbm.auto.R then overwriting the Rd file from gbm.auto_binonly.R, deleting all the changes. Sorry folks

dez93_2000
  • 1,730
  • 2
  • 23
  • 34