[Rd] index.search
Adrian Dușa
dusa.adrian at unibuc.ro
Mon Jun 16 17:51:51 CEST 2014
On Mon, Jun 16, 2014 at 10:32 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
> [...]
>
> Apropos "not the right tool". I'm a bit astonished that nobody
> mentioned the fact R already provides "the tool" to
> automatically compare all example outputs with a previous
> version (of the packages example outputs):
As appealing as this is, while trying to figure out a solution of my
own (until Martin's email), I think I've succeeded in creating a
rather useful function which allows fine grained control over each and
every line of code in the examples sections:
#############
helpfiles <- c(
"allExpressions",
"calibrate",
"createMatrix",
"deMorgan",
"demoChart",
"eqmcc",
"factorize",
"findSubsets",
"findSupersets",
"findTh",
"getRow",
"pof",
"solveChart",
"superSubset",
"truthTable"
)
testQCAmaybe <- function() {
results <- vector(mode="list", length=length(helpfiles))
names(results) <- helpfiles
for (i in seq(length(helpfiles))) {
Rdfile <- file.path(find.package("QCA"), paste(helpfiles[i],
".Rd", sep=""))
commands <- parse(text=capture.output(tools::Rd2ex(Rdfile)))
results[[i]] <- vector(mode="list", length=length(commands))
names(results[[i]]) <- commands
for (j in seq(length(commands))) {
results[[i]][[j]] <-
suppressWarnings(capture.output(eval(commands[j])))
}
}
return(results)
}
#############
Using all.equal(), over the entire list or sequentially over parts of
it quickly identifies sources of difference.
I hope this helps anyone,
Adrian
--
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel.:+40 21 3126618 \
+40 21 3120210 / int.101
Fax: +40 21 3158391
More information about the R-devel
mailing list