[Rd] Minimum of an ordered factor
Hi everybody, Is there a particular reason, why this code does not work as intended: z <- factor(LETTERS[1:3], ordered = TRUE) u <- 4:6 min(z[u > 4]) Error in Summary.factor(2:3, na.rm = FALSE) : min not meaningful for factors I agree that min is indeed not meaningful for not ordered factors, but it makes sense for ordered factors. Especially since z[3] < z[2] sort(z) _ARE_ defined and work as expected. Of course I can do something like sort(z[u>4])[1] but this does not enhance readability of my code. Thus, I overloaded Summary.ordered as follows: Summary.ordered <- function(..., na.rm) { ok <- switch(.Generic, max = , min = , range = TRUE, FALSE) if (!ok) { warning(sprintf("'%s' is not meaningful for ordered factors", .Generic)) return(NA) } args <- list(...) level.list <- lapply(args, levels) level.set <- Reduce(union, level.list) if (!all(sapply(args, is.ordered)) || !all(sapply(level.list, identical, y = level.set))) { stop(sprintf("'%s' is only meaningful for ordered factors if all arguments are ordered factors with the same level sets", .Generic)) } codes <- lapply(args, as.integer) ind <- do.call(.Generic, c(codes, na.rm = na.rm)) factor(level.set[ind], levels = level.set, ordered = TRUE) } Any comments appreciated. BR, Thorn [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] scoping/non-standard evaluation issue
Dear Peter, I played around a bit with your suggestion but wasn't able to get it to work. Thanks for this. John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf Of peter dalgaard > Sent: January-04-11 6:05 PM > To: John Fox > Cc: 'Sanford Weisberg'; r-devel@r-project.org > Subject: Re: [Rd] scoping/non-standard evaluation issue > > > On Jan 4, 2011, at 22:35 , John Fox wrote: > > > Dear r-devel list members, > > > > On a couple of occasions I've encountered the issue illustrated by the > > following examples: > > > > - snip --- > > > >> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + > > + Armed.Forces + Population + Year, data=longley) > > > >> mod.2 <- update(mod.1, . ~ . - Year + Year) > > > >> all.equal(mod.1, mod.2) > > [1] TRUE > >> > >> f <- function(mod){ > > + subs <- 1:10 > > + update(mod, subset=subs) > > + } > > > >> f(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >Population + Year, data = longley, subset = subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNPUnemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > > Population Year > > 1.164e+00-1.911e+00 > > > >> f(mod.2) > > Error in eval(expr, envir, enclos) : object 'subs' not found > > > > - snip --- > > > > I *almost* understand what's going -- that is, clearly mod.1 and mod.2, or > > the formulas therein, are associated with different environments, but I > > don't quite see why. > > > > Anyway, here are two "solutions" that work, but neither is in my view > > desirable: > > > > - snip --- > > > >> f1 <- function(mod){ > > + assign(".subs", 1:10, envir=.GlobalEnv) > > + on.exit(remove(".subs", envir=.GlobalEnv)) > > + update(mod, subset=.subs) > > + } > > > >> f1(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNPUnemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > > Population Year > > 1.164e+00-1.911e+00 > > > >> f1(mod.2) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNPUnemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > > Population Year > > 1.164e+00-1.911e+00 > > > >> f2 <- function(mod){ > > + env <- new.env(parent=.GlobalEnv) > > + attach(NULL) > > + on.exit(detach()) > > + assign(".subs", 1:10, pos=2) > > + update(mod, subset=.subs) > > + } > > > >> f2(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNPUnemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > > Population Year > > 1.164e+00-1.911e+00 > > > >> f2(mod.2) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNPUnemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > > Population Year > > 1.164e+00-1.911e+00 > > > > - snip --- > > > > The problem with f1() is that it will clobber a variable named .subs in the > > global environment; the problem with f2() is that .subs can be masked by a > > variable in the global environment. > > > > Is there a better approach? > > I think the best way would be to modify the environment of the formula. > Something like the below, except that it doesn't actually work... > > f3 <- function(mod) { > f <- formula(mod) > environment(f) <- e <- new.env(parent=environment(f)) > mod <- update(mod, formula=f) > evalq(.subs <- 1:10, e) > update(mod, subset=.subs) > } > > The catch is that it is not quite so easy to update the formula of a model. > > -- > Peter Dalgaard > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Email: pd@cbs.dk Priv: pda...@gmail.com > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __
Re: [Rd] scoping/non-standard evaluation issue
Dear Gabor, I used str() to look at the two objects but missed the difference that you found. What I didn't quite understand was why one model worked but not the other when both were defined at the command prompt in the global environment. Thanks, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf Of Gabor Grothendieck > Sent: January-04-11 6:56 PM > To: John Fox > Cc: Sanford Weisberg; r-devel@r-project.org > Subject: Re: [Rd] scoping/non-standard evaluation issue > > On Tue, Jan 4, 2011 at 4:35 PM, John Fox wrote: > > Dear r-devel list members, > > > > On a couple of occasions I've encountered the issue illustrated by the > > following examples: > > > > - snip --- > > > >> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + > > + Armed.Forces + Population + Year, data=longley) > > > >> mod.2 <- update(mod.1, . ~ . - Year + Year) > > > >> all.equal(mod.1, mod.2) > > [1] TRUE > >> > >> f <- function(mod){ > > + subs <- 1:10 > > + update(mod, subset=subs) > > + } > > > >> f(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > > Population + Year, data = longley, subset = subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNP Unemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02 -3.971e-03 -8.595e-03 > > Population Year > > 1.164e+00 -1.911e+00 > > > >> f(mod.2) > > Error in eval(expr, envir, enclos) : object 'subs' not found > > > > - snip --- > > > > I *almost* understand what's going -- that is, clearly mod.1 and mod.2, or > > the formulas therein, are associated with different environments, but I > > don't quite see why. > > > > Anyway, here are two "solutions" that work, but neither is in my view > > desirable: > > > > - snip --- > > > >> f1 <- function(mod){ > > + assign(".subs", 1:10, envir=.GlobalEnv) > > + on.exit(remove(".subs", envir=.GlobalEnv)) > > + update(mod, subset=.subs) > > + } > > > >> f1(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > > Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNP Unemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02 -3.971e-03 -8.595e-03 > > Population Year > > 1.164e+00 -1.911e+00 > > > >> f1(mod.2) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > > Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNP Unemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02 -3.971e-03 -8.595e-03 > > Population Year > > 1.164e+00 -1.911e+00 > > > >> f2 <- function(mod){ > > + env <- new.env(parent=.GlobalEnv) > > + attach(NULL) > > + on.exit(detach()) > > + assign(".subs", 1:10, pos=2) > > + update(mod, subset=.subs) > > + } > > > >> f2(mod.1) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > > Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNP Unemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02 -3.971e-03 -8.595e-03 > > Population Year > > 1.164e+00 -1.911e+00 > > > >> f2(mod.2) > > > > Call: > > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > > Population + Year, data = longley, subset = .subs) > > > > Coefficients: > > (Intercept) GNP.deflator GNP Unemployed Armed.Forces > > 3.641e+03 8.394e-03 6.909e-02 -3.971e-03 -8.595e-03 > > Population Year > > 1.164e+00 -1.911e+00 > > > > - snip --- > > > > The problem with f1() is that it will clobber a variable named .subs in the > > global environment; the problem with f2() is that .subs can be masked by a > > variable in the global environment. > > > > Is there a better approach? > > > > I think there is something wrong with R here since the formula in the > call component of mod.1 has a "call" class whereas the corresponding > call component of mod.2 has "formula" class: > > > class(mod.1$call[[2]]) > [1] "call" > > class(mod.2$call[[2]]) > [1] "formula" > > If we reset call[[2]] to have "call" class then it works: > > > mod.2a <- mod.2 > > mod.2a$call[[2]] <- as.call(as.list(mod.2a$call[[2]])) > > f(mod.2a) > > Call: > lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > Population + Year, data = longley, subset = subs) > > Coefficients: > (Intercept) GNP.deflato
Re: [Rd] Minimum of an ordered factor
> Thaler, Thorn, LAUSANNE, Applied Mathematics > > on Wed, 5 Jan 2011 11:20:47 +0100 writes: > Hi everybody, Is there a particular reason, why this code > does not work as intended: > z <- factor(LETTERS[1:3], ordered = TRUE) > u <- 4:6 > min(z[u > 4]) > Error in Summary.factor(2:3, na.rm = FALSE) : > min not meaningful for factors > I agree that min is indeed not meaningful for not ordered > factors, but it makes sense for ordered > factors. Especially since > z[3] < z[2] > sort(z) > _ARE_ defined and work as expected. I agree that it is natural then, to expect min(), max() and range() to work as well. > Of course I can do something like > sort(z[u>4])[1] > but this does not enhance readability of my code. Thus, I > overloaded Summary.ordered as follows: > Summary.ordered <- function(..., na.rm) { > ok <- switch(.Generic, max = , min = , range = TRUE, > FALSE) > if (!ok) { > warning(sprintf("'%s' is not meaningful for ordered > factors", .Generic)) > return(NA) > } > args <- list(...) > level.list <- lapply(args, levels) > level.set <- Reduce(union, level.list) > if (!all(sapply(args, is.ordered)) || > !all(sapply(level.list, identical, y = level.set))) { > stop(sprintf("'%s' is only meaningful for ordered > factors if all arguments are ordered factors with the same > level sets", > .Generic)) > } > codes <- lapply(args, as.integer) > ind <- do.call(.Generic, c(codes, na.rm = na.rm)) > factor(level.set[ind], levels = level.set, ordered = > TRUE) > } (the above is now even more garbled than it was already by your use of HTML-ified e-mail ..) But your code is fine, even nice, in most parts, and I will add (most of) it (and some documentation) to R-devel unless we get contradicting comments : > Any comments appreciated. (still) Thank you, Thorn! With regards, Martin Maechler, ETH Zurich __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] scoping/non-standard evaluation issue
On Jan 5, 2011, at 14:44 , John Fox wrote: > Dear Gabor, > > I used str() to look at the two objects but missed the difference that you > found. What I didn't quite understand was why one model worked but not the > other when both were defined at the command prompt in the global > environment. I kind of suspect that the bug is that mod.1 works... I.e., I can vaguely make out the contours of why mod.2 is not supposed to work and if that is true, neither should mod.1. However, if so, something clearly needs more work. Possibly, some of the people who worked on implement formula environments may want to chime in? (It's been a while, though.) > > Thanks, > John > > > John Fox > Senator William McMaster > Professor of Social Statistics > Department of Sociology > McMaster University > Hamilton, Ontario, Canada > web: socserv.mcmaster.ca/jfox > > >> -Original Message- >> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] > On >> Behalf Of Gabor Grothendieck >> Sent: January-04-11 6:56 PM >> To: John Fox >> Cc: Sanford Weisberg; r-devel@r-project.org >> Subject: Re: [Rd] scoping/non-standard evaluation issue >> >> On Tue, Jan 4, 2011 at 4:35 PM, John Fox wrote: >>> Dear r-devel list members, >>> >>> On a couple of occasions I've encountered the issue illustrated by the >>> following examples: >>> >>> - snip --- >>> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + >>> + Armed.Forces + Population + Year, data=longley) >>> mod.2 <- update(mod.1, . ~ . - Year + Year) >>> all.equal(mod.1, mod.2) >>> [1] TRUE f <- function(mod){ >>> + subs <- 1:10 >>> + update(mod, subset=subs) >>> + } >>> f(mod.1) >>> >>> Call: >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + >>>Population + Year, data = longley, subset = subs) >>> >>> Coefficients: >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 >>> Population Year >>> 1.164e+00-1.911e+00 >>> f(mod.2) >>> Error in eval(expr, envir, enclos) : object 'subs' not found >>> >>> - snip --- >>> >>> I *almost* understand what's going -- that is, clearly mod.1 and mod.2, > or >>> the formulas therein, are associated with different environments, but I >>> don't quite see why. >>> >>> Anyway, here are two "solutions" that work, but neither is in my view >>> desirable: >>> >>> - snip --- >>> f1 <- function(mod){ >>> + assign(".subs", 1:10, envir=.GlobalEnv) >>> + on.exit(remove(".subs", envir=.GlobalEnv)) >>> + update(mod, subset=.subs) >>> + } >>> f1(mod.1) >>> >>> Call: >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + >>>Population + Year, data = longley, subset = .subs) >>> >>> Coefficients: >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 >>> Population Year >>> 1.164e+00-1.911e+00 >>> f1(mod.2) >>> >>> Call: >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + >>>Population + Year, data = longley, subset = .subs) >>> >>> Coefficients: >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 >>> Population Year >>> 1.164e+00-1.911e+00 >>> f2 <- function(mod){ >>> + env <- new.env(parent=.GlobalEnv) >>> + attach(NULL) >>> + on.exit(detach()) >>> + assign(".subs", 1:10, pos=2) >>> + update(mod, subset=.subs) >>> + } >>> f2(mod.1) >>> >>> Call: >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + >>>Population + Year, data = longley, subset = .subs) >>> >>> Coefficients: >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 >>> Population Year >>> 1.164e+00-1.911e+00 >>> f2(mod.2) >>> >>> Call: >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + >>>Population + Year, data = longley, subset = .subs) >>> >>> Coefficients: >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 >>> Population Year >>> 1.164e+00-1.911e+00 >>> >>> - snip --- >>> >>> The problem with f1() is that it will clobber a variable named .subs in > the >>> global environment; the problem with f2() is that .subs can be masked by > a >>> variable in the global environment. >>> >>> Is there a better approach? >>> >> >> I think there is something wrong with R here since the formula in the >> call component of mod.1 has a "call" class whereas the
Re: [Rd] scoping/non-standard evaluation issue
Dear Peter, You hit the nail on the head: I didn't (and don't) understand why mod.1 works -- which I attributed to my imperfect understanding of non-standard evaluation. Even if there's a bug allowing mod.1 to work, I wonder about the consequences of fixing it. That might break a lot of code. It would seem desirable, though, for mod.1 and mod.2 to behave the same. Best, John > -Original Message- > From: peter dalgaard [mailto:pda...@gmail.com] > Sent: January-05-11 10:51 AM > To: John Fox > Cc: 'Gabor Grothendieck'; 'Sanford Weisberg'; r-devel@r-project.org > Subject: Re: [Rd] scoping/non-standard evaluation issue > > > On Jan 5, 2011, at 14:44 , John Fox wrote: > > > Dear Gabor, > > > > I used str() to look at the two objects but missed the difference that you > > found. What I didn't quite understand was why one model worked but not the > > other when both were defined at the command prompt in the global > > environment. > > I kind of suspect that the bug is that mod.1 works... I.e., I can vaguely > make out the contours of why mod.2 is not supposed to work and if that is > true, neither should mod.1. However, if so, something clearly needs more > work. Possibly, some of the people who worked on implement formula > environments may want to chime in? (It's been a while, though.) > > > > > Thanks, > > John > > > > > > John Fox > > Senator William McMaster > > Professor of Social Statistics > > Department of Sociology > > McMaster University > > Hamilton, Ontario, Canada > > web: socserv.mcmaster.ca/jfox > > > > > >> -Original Message- > >> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] > > On > >> Behalf Of Gabor Grothendieck > >> Sent: January-04-11 6:56 PM > >> To: John Fox > >> Cc: Sanford Weisberg; r-devel@r-project.org > >> Subject: Re: [Rd] scoping/non-standard evaluation issue > >> > >> On Tue, Jan 4, 2011 at 4:35 PM, John Fox wrote: > >>> Dear r-devel list members, > >>> > >>> On a couple of occasions I've encountered the issue illustrated by the > >>> following examples: > >>> > >>> - snip --- > >>> > mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + > >>> + Armed.Forces + Population + Year, data=longley) > >>> > mod.2 <- update(mod.1, . ~ . - Year + Year) > >>> > all.equal(mod.1, mod.2) > >>> [1] TRUE > > f <- function(mod){ > >>> + subs <- 1:10 > >>> + update(mod, subset=subs) > >>> + } > >>> > f(mod.1) > >>> > >>> Call: > >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >>>Population + Year, data = longley, subset = subs) > >>> > >>> Coefficients: > >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces > >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > >>> Population Year > >>> 1.164e+00-1.911e+00 > >>> > f(mod.2) > >>> Error in eval(expr, envir, enclos) : object 'subs' not found > >>> > >>> - snip --- > >>> > >>> I *almost* understand what's going -- that is, clearly mod.1 and mod.2, > > or > >>> the formulas therein, are associated with different environments, but I > >>> don't quite see why. > >>> > >>> Anyway, here are two "solutions" that work, but neither is in my view > >>> desirable: > >>> > >>> - snip --- > >>> > f1 <- function(mod){ > >>> + assign(".subs", 1:10, envir=.GlobalEnv) > >>> + on.exit(remove(".subs", envir=.GlobalEnv)) > >>> + update(mod, subset=.subs) > >>> + } > >>> > f1(mod.1) > >>> > >>> Call: > >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >>>Population + Year, data = longley, subset = .subs) > >>> > >>> Coefficients: > >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces > >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > >>> Population Year > >>> 1.164e+00-1.911e+00 > >>> > f1(mod.2) > >>> > >>> Call: > >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >>>Population + Year, data = longley, subset = .subs) > >>> > >>> Coefficients: > >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces > >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > >>> Population Year > >>> 1.164e+00-1.911e+00 > >>> > f2 <- function(mod){ > >>> + env <- new.env(parent=.GlobalEnv) > >>> + attach(NULL) > >>> + on.exit(detach()) > >>> + assign(".subs", 1:10, pos=2) > >>> + update(mod, subset=.subs) > >>> + } > >>> > f2(mod.1) > >>> > >>> Call: > >>> lm(formula = Employed ~ GNP.deflator + GNP + Unemployed + Armed.Forces + > >>>Population + Year, data = longley, subset = .subs) > >>> > >>> Coefficients: > >>> (Intercept) GNP.deflator GNPUnemployed Armed.Forces > >>> 3.641e+03 8.394e-03 6.909e-02-3.971e-03-8.595e-03 > >>> Po
Re: [Rd] \VignetteKeywords{}, for KEYWORDS or for free-tagging?
Hi Kurt, Thank you very much for clarifying this. I hope that some documentation may be written about these commands and added to one of the manuals in the future. + Elliot On Wed, 5 Jan 2011, Kurt Hornik wrote: Elliot Todd Kleiman writes: Hi Kurt, Thank you for the info! However, I would also like to ask: * Since the user may use any words as 'keywords', what is the purpose of this command and what are the benefits of using it? * Where is the documentation for the '\Vignette*' commands? Because other than the '\VignetteIndexEntry' command, I could not find any mentioning of them in the R-exts manual, http://cran.r-project.org/doc/manuals/R-exts.html. I don't think that the vignette metadata are currently used "a lot". They make it into the vignette index but users don't get to play with this. (There are long-standing plans to integrate vignettes into the help system [with help and help.search], though.) Best -k Best, + Elliot On Mon, 3 Jan 2011, Kurt Horniks wrote: Elliot Todd Kleiman writes: Hi R-devel, [Question]: * Is there a KEYWORDS file to lookup 'keywords' to supply the vignette command, '\VignetteKeywords{}'? -or, is the pkg writer free to tag the vignette using any keywords he/she chooses? i.e., free-tagging. For vignette keywords, the latter. Best -k Thank you, + Elliot Kleiman __ San Diego State University http://www.sdsu.edu/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel