From dusa.adrian at unibuc.ro  Mon Jun 16 17:51:51 2014
From: dusa.adrian at unibuc.ro (=?UTF-8?B?QWRyaWFuIER1yJlh?=)
Date: Mon, 16 Jun 2014 18:51:51 +0300
Subject: [Rd] index.search
In-Reply-To: <21406.40353.259201.480277@stat.math.ethz.ch>
References: <CAJ=0CtANJ8UALh8bwv+CceC75+sAmm-SEhNsFiqd=XUjpbs_tg@mail.gmail.com>
	<CADwqtCNrh5v1vgMtoJWW7Pd+m+xs4n0diXC8mZA=qeqbngLFiw@mail.gmail.com>
	<CAJ=0CtCuZZF2d7eWZzv96myB8cd88Pyks=uFdNiJdcxzbcnzhA@mail.gmail.com>
	<CADwqtCNUjqsDStxxuo5w7WpK+7wCuTcruwLV=PTFKKTbVmW2NA@mail.gmail.com>
	<CAJ=0CtBD32=SzJi7Zf_DR2THoOiZ3L32MHtzW3+a0V+VE-JvAg@mail.gmail.com>
	<21406.40353.259201.480277@stat.math.ethz.ch>
Message-ID: <CAJ=0CtCq3-rj95zk0G=3PVHcoyMAQfhiY7b=V_q4h_sY0tHSUg@mail.gmail.com>

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



[Rd] index.search
=?UTF-8?B?QWRyaWFuIER1yJlh?=