[R] Bug in function arguments autocomplete and ellipsis?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Fri May 8 18:24:46 CEST 2020


It would help if you consulted the docs, in this case, **The R
Language Definition** and, in particular, 4.3.2 on argument matching.
I won't repeat what it is there, but I believe it will suffice to
dispel your confusion.


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Fri, May 8, 2020 at 7:49 AM Roman Olson <romanolson using yonsei.ac.kr> wrote:
>
> Dear All,
>
> I am wondering whether function arguments autocomplete causes a bug when additional ellipsis arguments are used.
>
> Example:
> a = function(robot) {
>     cat(robot, "\n")
>  }
> a(r=5) prints 5, meaning that r is autocompleted to “robot”. Not sure if this is normal behavior, but this does not cause problems.
>
> This would be fine, but somehow causes problems when there is an additional ellipsis argument that can be used to autocomplete an already existing argument. In the example below, when we are calling sens.analysis.all, everything starting with q is an additional argument (…). Now, k is missed completely. And that is because there is another actual argument that starts with k — key.legend.axes (it is assigned to 4 instead). If “k=4” is changed to “kk=4” the problem disappears.
>
> sens.analysis.all <- function(func, outgrid, parvec, parmin, parmax,
>                               length.pgrid, outvname, zlim, plabs,
>                               gridlab, mylog, outlog=FALSE, ytick=NULL,
>                               xline=NULL, yline=NULL, mypal=topo.colors,
>                               key.legend.axes=NULL, plot.guidance=FALSE, ... ) {
>
>    cat(..1, "\n")
>    cat(..2, "\n")
>    cat(..3, "\n")
>
>    out=1
>    out
> }
>
> out = sens.analysis.all(numer.wait.times.wrps, NA,
>      c(5.4, 0.008, 1.5), c(4.9, 0.0079, 2.0), c(5.5, 0.0090, 3.5),
>        length.pgrid=10, outvname="cvs", zlim=c(0.3, 2),
>        plabs=c("mu", "lambda", "b"), gridlab="Soil Moisture [mm]",
>        mylog=FALSE, outlog=FALSE, yline=2, plot.guidance=FALSE, q=3.1, k=4, y.c=670,
>        realgrid=seq(630, 670, by=4), myseed=0,
>        nt=1000000, burnin=300000, bin.cutoff=500,
>        bdW.prelim=prec.struct.Mal)
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list