Adrian,
R isn't really designed to use multiple versions of the same package in the
same R session. To do what you want you'll need to unload one version of
the package before you load the next, which will work some percentage of
the time between 50 and 100 ("usually"), but when it can be done it is
relatively easy to do.
Packages with C code will give you problems, or at least they used to. I
haven't tried recently. See Prof Ripley's response here: See
https://stat.ethz.ch/pipermail/r-devel/2009-February/052229.html
For packages that can be unloaded/reloaded safely, is there a reason you
can't just use the existing example function with two different library
locations (lib.loc argument) with the two package versions installed?
~G
On Sun, Jun 15, 2014 at 6:22 PM, Adrian Dușa <dusa.adrian@unibuc.ro>
wrote:
> Dear r-devel,
>
> I am trying to automatically check if two successive versions of a
> package have the same results (i.e. code not broken), by parsing the
> example sections for each function against a previously tested
> version.
>
> While trying to replicate the code from example(), I am facing an
> error related with te "index.search" function (line 7 in the
example()
> code).
> This is the code I am using:
>
> example2 <- function (topic, package = NULL, lib.loc = NULL,
> character.only = FALSE,
> give.lines = FALSE, local = FALSE, echo = TRUE, verbose >
getOption("verbose"),
> setRNG = FALSE, ask = getOption("example.ask"), prompt.prefix
> abbreviate(topic, 6), run.dontrun = FALSE)
> {
> if (!character.only) {
> topic <- substitute(topic)
> if (!is.character(topic))
> topic <- deparse(topic)[1L]
> }
> pkgpaths <- find.package(package, lib.loc, verbose = verbose)
> file <- index.search(topic, pkgpaths, TRUE)
> return(file)
> }
>
> > example2("deMorgan", package="QCA")
> Error in example2("deMorgan", package = "QCA") :
> could not find function "index.search"
>
>
> I've tried an explicit library(utils), with the same result.
> ?index.search doesn't yield anything better...
>
> Could anyone point me in the right direction, please?
> Thank you,
> 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
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Gabriel Becker
Graduate Student
Statistics Department
University of California, Davis
[[alternative HTML version deleted]]