Skip to content

*Do* name function arguments in a call (apart from the first few)! - patch to be applied to plot.spe() in SortedEffects/R/spe.R #4

@mmaechler

Description

@mmaechler

As I wrote in issue #3 ... there is problem in your code you should fix, notably as it fixes the slightly change plot.default() function in the development version of R (aka R-devel):
https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-gcc/SortedEffects-00check.html

The following patch (aka "diff") is against the CRAN version of R/spe.R .. possibly differing from the outdated current GH version:

--- SortedEffects_CRAN/R/spe.R	2021-09-01 02:13:18.000000000 +0200
+++ SortedEffects/R/spe.R	2025-09-05 11:36:18.974462587 +0200
@@ -320,8 +320,8 @@
   us <- x$us
   alpha <- x$alpha
   xlim <- range(us)
-  plot(us, SE[[1]], type = "l", xlim, ylim, log = "", main, sub, xlab, ylab,
-       col = 4, lwd = 2)
+  plot(us, SE[[1]], type = "l", xlim=xlim, ylim=ylim, log = "",
+       main=main, sub=sub, xlab=xlab, ylab=ylab, col = 4, lwd = 2)
   polygon(c(us, rev(us)),c(SE[[2]], rev(SE[[3]])), density = 60, border = F,
           col = 'light blue', lty = 1, lwd = 1)
   lines(us, SE[[1]], lwd = 2, col = 4 )

I assume you are aware that it is very unsafe, not to name arguments in a function (apart from the first or first two, typically);
even more so when the function is a generic function as plot() where you make assumption about the default method plot.default() and its exact order/position of arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions