[ESS] Roxygen Update is "off by one" in function

Paul Johnson p@u|john32 @end|ng |rom gm@||@com
Tue Feb 5 17:13:42 CET 2019


With Ubuntu Emacs 25.2 and ESS 18.10.3snapshot, In development mode within
a package, I just saw this weird thing happen.

I was in one function and used the menu ESS /Roxygen /Update Template and
then the parameter list was updated by insertion of the parameters before
this one in the file. That's a new thing, I've never seen it before.

Here's what I start with:

##' Draw standard error bar for discrete variables
##'
##' Used with plotSlopes if plotx is discrete
##'
##' @param x The estimate of the center point
##' @param lwr The lower confidence interval bound
##' @param upr The upper confidence interval bound
##' @param arrow.width Arrowhead length must be specified in inches. See
?arrows
##' @param width Thickness of shaded column
##' @param col Color for a bar
##' @param opacity 120 is default, that's partial see through.
##' @return NONE
##' @export
##' @author Paul Johnson
##'
se.bars <- function(x, y, lwr, upr, width=1, col = col.se, opacity = 120,
lwd = 1) {
    h <- 0.35 * width #half width
    q <- 0.15 * width #quarter width
    d <- 0.05 * width #shaded area
    iCol <- col2rgb(col)
    bCol <- mapply(rgb, red = iCol[1,], green = iCol[2,],
                   blue = iCol[3,], alpha = opacity, maxColorValue = 255)
    ### sCol: shade color
    sCol <-  mapply(rgb, red = iCol[1,], green = iCol[2,],
                    blue = iCol[3,], alpha = opacity/3, maxColorValue = 255)
    lCol <- mapply(rgb, red = iCol[1,], green = iCol[2,],
                   blue = iCol[3,], alpha = min(255, 2*opacity),
maxColorValue = 255)
    if (!is.null(lwr)){
        polygon(c(x-d, x+d, x+d,  x-d), c(rep(lwr, 2), rep(upr, 2)), col =
sCol, border = bCol)
        ## PROBLEM: lwd widths are not linked to lwd parameter.
        ##  arrows(x0 = x, y0 = lwr, y1 = upr, code=3, angle=90,
length=arrow.width, col = lCol, cex=0.5, lwd = 2)
        lines(c(x, x), c(lwr, upr), col = lCol, cex=0.5, lwd = 2, lend = 1,
ljoin = 1)
        lines(c(x, x) + c(-q, q), c(lwr, lwr), col = lCol, cex = 0.5, lwd =
lwd, lend = 1, ljoin = 1, lmitre = 2)
        lines(c(x, x) + c(-q, q), c(upr, upr), col = lCol, cex = 0.5, lwd =
lwd, lend = 1, ljoin = 1, lmitre = 2)
    }
    lines(c(x, x) + c(-h, h), c(y, y), col = lCol, lwd = lwd + 1)
    NULL
}

After ESS / Roxygen /Update, I get all the arguments inserted that don't
belong with this function
##'
##' Used with plotSlopes if plotx is discrete
##'
##' @param newdf
##' @param olddf
##' @param plotx
##' @param modx
##' @param modxVals
##' @param interval
##' @param plotPoints
##' @param plotLegend
##' @param legendTitle
##' @param col Color for a bar
##' @param llwd
##' @param opacity 120 is default, that's partial see through.
##' @param ...
##' @param x The estimate of the center point
##' @param lwr The lower confidence interval bound
##' @param upr The upper confidence interval bound
##' @param arrow.width Arrowhead length must be specified in inches. See
?arrows
##' @param width Thickness of shaded column
##' @return NONE
##' @export
##' @author Paul Johnson
##'

Those newly inserted arguments come from the one before.

Between functions in the R file, I have NULL because that was recommended
for Roxygen authors in the old days.  Nothing else special.

Can you reproduce?

PJ

-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

	[[alternative HTML version deleted]]



More information about the ESS-help mailing list