The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
reprex makes your bug reproducible.
minex makes it minimal.
When you ask for help with R, you are told to post a minimal
reproducible example. The reprex package runs and formats
your code; it does not shrink it. minex shrinks it: paste
in a failing script and it returns the smallest subset of statements
that still throws the same error, finding it by delta debugging rather
than by deleting lines and re-running by hand.
# install.packages("pak")
pak::pak("DIGlabUAB/minex")library(minex)
script <- c(
"a <- 10",
"b <- 20",
"log('not a number')"
)
minex(code = script)
#> <minex_result> 3 statement(s) reduced to 1 (3 oracle call(s))
#> target failure: non-numeric argument to mathematical function
#> ------------------------------------------------
#> log('not a number')The setup lines are dropped and only the offending statement remains. A statement that the failure genuinely depends on is kept, because removing it changes the error and the reduction is rejected.
minex() also reads a file directly:
minex(file = "analysis.R")And reduce_rows() does the same job for a data frame,
returning the rows that still reproduce a failure:
df <- data.frame(id = 1:6, value = c(3, 8, 999, 2, 5, 7))
reduce_rows(df, function(d) any(d$value > 100))
#> id value
#> 3 3 999Each candidate reduction runs in a fresh R process (via
callr) so that statement dependencies and side effects are
respected. A candidate “reproduces” the failure when it errors with the
same message as the original; matching on the condition class instead,
or supplying a custom oracle, is also supported. The engine is
ddmin(), an implementation of the delta debugging algorithm
of Zeller and Hildebrandt (2002), exposed for reuse on any
collection.
See vignette("minex") for the full walkthrough.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.