Re: [Rd] index.search
On Mon, Jun 16, 2014 at 10:32 AM, Martin Maechler 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 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
On 16/06/2014 3:32 AM, Martin Maechler wrote: > Adrian Dușa > on Mon, 16 Jun 2014 08:33:59 +0300 writes: > On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker > wrote: >> [...] You can. This is valid R source, so the parser >> will understand it >> >> expr = parse(text= example("deMorgan", package="QCA", >> give.lines=TRUE)) >> >> You can then evaluate some or all of that expression >> using either R's own eval package or, e.g. Hadley >> Wickham's evaluate package (for your particular usecase >> evaluate will be easier I think). > Oh, I see...! In that case I can use it, of course. Did > install the evaluate package, although one would expect > some better documentation (no examples at all, especially > at the main evaluate function). >>> [...] >> index.search is an unexported function, which means that >> it is subject to change in how it behaves without notice >> or even externally available reasons. You can get it via >> :::, but again, it's really not the right tool here, and >> not safe to use in general in code you expect to keep >> working. > Yes, I figured that much. Of course it's not meant to be > used in any decently working code, but I learn heavily by > simply looking at these sort of (hidden) R functions. > Thanks again, Adrian 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): *THE* manual (every package writer should know about, re-read/browse about once a year, and search in for such questions): "Writing R Extensions", section Package subdirectories (e.g. on the CRAN master in Vienna, http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories ) says |If directory 'tests' has a subdirectory 'Examples' containing a file |'PKG-Ex.Rout.save', this is compared to the output file for running the |examples when the latter are checked. So: After an 'R CMD check ' you only need to take and keep the -Ex.Rout file that is produced (in the PKG.Rcheck/ directory), and save it into /tests/-Ex.Rout.save and from then on, every time you run R CMD check the comparison will be made. It's also worth mentioning that there is something similar to test for changes to vignettes: If there is a target output file .Rout.save in the vignette source directory, the output from running the code in that vignette is compared with the target output file and any differences are reported (but not recorded in the log file). The slightly surprising thing is that R CMD check doesn't produce .Rout; the file that is compared to .Rout.save is .log. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
Thanks for the great insight. I love that there's always something else to learn in R. â¢â¢â¢â¢â¢ Brian Lee Yung Rowe Founder, Zato Novo Professor, M.S. Data Analytics, CUNY On Jun 16, 2014, at 3:34 AM, Martin Maechler wrote: >> Adrian DuÈa >>on Mon, 16 Jun 2014 08:33:59 +0300 writes: > >> On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker >> wrote: >>> [...] You can. This is valid R source, so the parser >>> will understand it >>> >>> expr = parse(text= example("deMorgan", package="QCA", >>> give.lines=TRUE)) >>> >>> You can then evaluate some or all of that expression >>> using either R's own eval package or, e.g. Hadley >>> Wickham's evaluate package (for your particular usecase >>> evaluate will be easier I think). > >> Oh, I see...! In that case I can use it, of course. Did >> install the evaluate package, although one would expect >> some better documentation (no examples at all, especially >> at the main evaluate function). > > [...] >>> index.search is an unexported function, which means that >>> it is subject to change in how it behaves without notice >>> or even externally available reasons. You can get it via >>> :::, but again, it's really not the right tool here, and >>> not safe to use in general in code you expect to keep >>> working. > >> Yes, I figured that much. Of course it's not meant to be >> used in any decently working code, but I learn heavily by >> simply looking at these sort of (hidden) R functions. > >> Thanks again, Adrian > > 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): > > *THE* manual (every package writer should know about, > re-read/browse about once a year, and search in for such questions): > > "Writing R Extensions", section Package subdirectories > > (e.g. on the CRAN master in Vienna, > http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories ) > says > > |If directory 'tests' has a subdirectory 'Examples' containing a file > |'PKG-Ex.Rout.save', this is compared to the output file for running the > |examples when the latter are checked. > > So: After an 'R CMD check ' you only need to take and > keep the -Ex.Rout file that is produced (in the > PKG.Rcheck/ directory), and save it into /tests/-Ex.Rout.save > and from then on, every time you run R CMD check the > comparison will be made. > > Martin Maechler, ETH Zurich > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
Oh my... this is so simple, why didn't I think of that...? Thanks a lot Martin, beautiful, Adrian On Mon, Jun 16, 2014 at 10:32 AM, Martin Maechler wrote: >> Adrian Duºa >> on Mon, 16 Jun 2014 08:33:59 +0300 writes: > > > On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker > > wrote: > >> [...] You can. This is valid R source, so the parser > >> will understand it > >> > >> expr = parse(text= example("deMorgan", package="QCA", > >> give.lines=TRUE)) > >> > >> You can then evaluate some or all of that expression > >> using either R's own eval package or, e.g. Hadley > >> Wickham's evaluate package (for your particular usecase > >> evaluate will be easier I think). > > > Oh, I see...! In that case I can use it, of course. Did > > install the evaluate package, although one would expect > > some better documentation (no examples at all, especially > > at the main evaluate function). > > > >>> [...] > >> index.search is an unexported function, which means that > >> it is subject to change in how it behaves without notice > >> or even externally available reasons. You can get it via > >> :::, but again, it's really not the right tool here, and > >> not safe to use in general in code you expect to keep > >> working. > > > Yes, I figured that much. Of course it's not meant to be > > used in any decently working code, but I learn heavily by > > simply looking at these sort of (hidden) R functions. > > > Thanks again, Adrian > > 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): > > *THE* manual (every package writer should know about, > re-read/browse about once a year, and search in for such questions): > > "Writing R Extensions", section Package subdirectories > > (e.g. on the CRAN master in Vienna, > http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories ) > says > > |If directory 'tests' has a subdirectory 'Examples' containing a file > |'PKG-Ex.Rout.save', this is compared to the output file for running the > |examples when the latter are checked. > > So: After an 'R CMD check ' you only need to take and > keep the -Ex.Rout file that is produced (in the > PKG.Rcheck/ directory), and save it into /tests/-Ex.Rout.save > and from then on, every time you run R CMD check the > comparison will be made. > > Martin Maechler, ETH Zurich -- 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
Re: [Rd] index.search
> Adrian Dușa > on Mon, 16 Jun 2014 08:33:59 +0300 writes: > On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker > wrote: >> [...] You can. This is valid R source, so the parser >> will understand it >> >> expr = parse(text= example("deMorgan", package="QCA", >> give.lines=TRUE)) >> >> You can then evaluate some or all of that expression >> using either R's own eval package or, e.g. Hadley >> Wickham's evaluate package (for your particular usecase >> evaluate will be easier I think). > Oh, I see...! In that case I can use it, of course. Did > install the evaluate package, although one would expect > some better documentation (no examples at all, especially > at the main evaluate function). >>> [...] >> index.search is an unexported function, which means that >> it is subject to change in how it behaves without notice >> or even externally available reasons. You can get it via >> :::, but again, it's really not the right tool here, and >> not safe to use in general in code you expect to keep >> working. > Yes, I figured that much. Of course it's not meant to be > used in any decently working code, but I learn heavily by > simply looking at these sort of (hidden) R functions. > Thanks again, Adrian 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): *THE* manual (every package writer should know about, re-read/browse about once a year, and search in for such questions): "Writing R Extensions", section Package subdirectories (e.g. on the CRAN master in Vienna, http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories ) says |If directory 'tests' has a subdirectory 'Examples' containing a file |'PKG-Ex.Rout.save', this is compared to the output file for running the |examples when the latter are checked. So: After an 'R CMD check ' you only need to take and keep the -Ex.Rout file that is produced (in the PKG.Rcheck/ directory), and save it into /tests/-Ex.Rout.save and from then on, every time you run R CMD check the comparison will be made. Martin Maechler, ETH Zurich __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker wrote: > [...] > You can. This is valid R source, so the parser will understand it > > expr = parse(text= example("deMorgan", package="QCA", give.lines=TRUE)) > > You can then evaluate some or all of that expression using either R's own > eval package or, e.g. Hadley Wickham's evaluate package (for your particular > usecase evaluate will be easier I think). Oh, I see...! In that case I can use it, of course. Did install the evaluate package, although one would expect some better documentation (no examples at all, especially at the main evaluate function). >> [...] > index.search is an unexported function, which means that it is subject to > change in how it behaves without notice or even externally available > reasons. You can get it via :::, but again, it's really not the right tool > here, and not safe to use in general in code you expect to keep working. Yes, I figured that much. Of course it's not meant to be used in any decently working code, but I learn heavily by simply looking at these sort of (hidden) R functions. Thanks again, 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
Re: [Rd] index.search
On Mon, Jun 16, 2014 at 6:36 AM, Brian Lee Yung Rowe wrote: > Adrian, > > You might consider using a unit testing framework such as RUnit or testthat, > which does this but in a more structured manner. Essentially you codify the > behavior in a set of tests as opposed to comparing with a previous version. Right... I knew there was a better way to handle this. Will take a look on those and try to build something on them. Best, 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
Re: [Rd] index.search
On Sun, Jun 15, 2014 at 8:23 PM, Adrian DuÈa wrote: > Hi Gabriel, > > > I tried using the example() function, like this: > example("deMorgan", package="QCA", give.lines=TRUE) > > That returns the commands from the examples section, but if a command > is split over multiple rows I cannot use it automatically. > You can. This is valid R source, so the parser will understand it expr = parse(text= example("deMorgan", package="QCA", give.lines=TRUE)) You can then evaluate some or all of that expression using either R's own eval package or, e.g. Hadley Wickham's evaluate package (for your particular usecase evaluate will be easier I think). > > I could also use: > capture.output(example("deMorgan", package="QCA", ask=FALSE)) > > That would indeed work for the printed output, but I would also like > to compare the objects saved by the deMorgan() function. If that is > not possible, I'll probably be happy with the printed output. > > I'd still be curious as to why the index.search() function cannot be > used... (it seems useful for other purposes). > index.search is an unexported function, which means that it is subject to change in how it behaves without notice or even externally available reasons. You can get it via :::, but again, it's really not the right tool here, and not safe to use in general in code you expect to keep working. HTH, ~G > > Best wishes, > Adrian > > > On Mon, Jun 16, 2014 at 5:46 AM, Gabriel Becker > wrote: > > 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 > 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 > > > > -- > 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 > -- Gabriel Becker Graduate Student Statistics Department University of California, Davis [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
Adrian, You might consider using a unit testing framework such as RUnit or testthat, which does this but in a more structured manner. Essentially you codify the behavior in a set of tests as opposed to comparing with a previous version. HTH, Brian â¢â¢â¢â¢â¢ Brian Lee Yung Rowe Founder, Zato Novo Professor, M.S. Data Analytics, CUNY > On Jun 15, 2014, at 11:25 PM, "Adrian DuÈa" wrote: > > Hi Gabriel, > > Actually, I am not going to use multiple versions of the same package, > but always the last version. What I would like to do is: > - to run all examples from all functions in the package, saving the > results into a list > - compare the list to an already saved one (from the previous version > of the package), possibly using all.equal() > > I tried using the example() function, like this: > example("deMorgan", package="QCA", give.lines=TRUE) > > That returns the commands from the examples section, but if a command > is split over multiple rows I cannot use it automatically. > > I could also use: > capture.output(example("deMorgan", package="QCA", ask=FALSE)) > > That would indeed work for the printed output, but I would also like > to compare the objects saved by the deMorgan() function. If that is > not possible, I'll probably be happy with the printed output. > > I'd still be curious as to why the index.search() function cannot be > used... (it seems useful for other purposes). > > Best wishes, > Adrian > > >> On Mon, Jun 16, 2014 at 5:46 AM, Gabriel Becker wrote: >> 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 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 > > > > -- > 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 [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] index.search
Hi Gabriel, Actually, I am not going to use multiple versions of the same package, but always the last version. What I would like to do is: - to run all examples from all functions in the package, saving the results into a list - compare the list to an already saved one (from the previous version of the package), possibly using all.equal() I tried using the example() function, like this: example("deMorgan", package="QCA", give.lines=TRUE) That returns the commands from the examples section, but if a command is split over multiple rows I cannot use it automatically. I could also use: capture.output(example("deMorgan", package="QCA", ask=FALSE)) That would indeed work for the printed output, but I would also like to compare the objects saved by the deMorgan() function. If that is not possible, I'll probably be happy with the printed output. I'd still be curious as to why the index.search() function cannot be used... (it seems useful for other purposes). Best wishes, Adrian On Mon, Jun 16, 2014 at 5:46 AM, Gabriel Becker wrote: > 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 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 -- 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
Re: [Rd] index.search
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 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]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] index.search
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