[Rd] ggplot2: Add '+' operator for aes (uneval) objects

2013-11-04 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear all, Is there a reason, why there is no +-operator for aes (i.e. uneval) objects (as there is for themes and gg objects)? I had a couple of cases where such an operator would be useful, for instance to combine the result of aes and aes_string in functions. Any flaws with the following

[Rd] Design choice of plot.design for formulas

2012-03-19 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear all, Today I figured out that the formula interface of plot.design is kind of counter intuitive. Suppose the following setting ddf - expand.grid(a=factor(1:3), b=factor(1:3)) ddf$y - rnorm(9) plot.design(y ~ a + b, data=ddf) which does what it should do, basically printing the means for

[Rd] Overwrite S3 methond from base package

2012-02-13 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear all, I am developing a package, which bundles my most frequently used functions. One of those is a modified version of droplevels from the base package (basically, it preserves any contrast function which was used to create the factor, contrast matrices are not kept, for they could be wrong

Re: [Rd] Overwrite S3 methond from base package

2012-02-13 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
In regard to should, I think it is a very very bad idea. The result that someone gets depends on whether or not the new package is attached in the session. That is a recipe for hours (or days) of trying to figure out mysterious behavior. I fully agree. However, there are 2 reasons in

Re: [Rd] droplevels: drops contrasts as well

2011-10-25 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
I think this behaviour is annoying, because if one does not look carefully enough, one looses the contrasts silently. Hence may I suggest to change the code of droplevels to something like the following: This silently changes the contrasts -- eg, if the first level of the factor is one

[Rd] droplevels: drops contrasts as well

2011-10-21 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Dear all, Today I figured out that there is a neat function called droplevels, which, well, drops unused levels in a data frame. I tried the function with some of my data sets and it turned out that not only the unused levels were dropped but also the contrasts I set via C. I had a look into the

[Rd] update.default: fall back on model.frame in case that the data frame is not in the parent environment

2011-08-02 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Dear all, Suppose the following code: --8-- mm - function(datf) { lm(y ~ x, data = datf) } mydatf - data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10))) l - mm(mydatf) --8-- If I want to update l now without providing the data argument an

Re: [Rd] update.default: fall back on model.frame in case that the data frame is not in the parent environment

2011-08-02 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
mm - function(datf) { lm(y ~ x, data = datf) } mydatf - data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10)), z = rnorm(20)) l - mm(mydatf) update(l, . ~ . + z) # This fails, z is not found Good point. So let me rephrase the initial problem: 1.) An lm object is fitted somewhere

[Rd] stats:::biplot.prcomp: Scaling, typo in the help file?

2011-05-11 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Dear all, From the documentation of biplot.prcomp: scale: The variables are scaled by 'lambda ^ scale' and the observations are scaled by 'lambda ^ (1-scale)' where 'lambda' are the singular values as computed by 'princomp'. From the source code of prcomp: lam -

Re: [Rd] Minimum of an ordered factor

2011-01-07 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Martin Maechler writes I have now committed the amended proposal (rev 53925); thank you for the feedbacks.. I had a look at it and there is a typo: stop(gettextf('%s' not defined for \difftime\ objects, .Generic), domain = NA) should rather be stop(gettextf('%s' not defined for

Re: [Rd] Minimum of an ordered factor

2011-01-06 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Kurt Hornik writes if (!all(sapply(args, is.ordered)) || !all(sapply(level.list, identical, y = level.set))) { I think it would be better to use something like ll - lapply(args, levels) !all(sapply(ll, identical, ll[[1L]])) [using union() is not quite right] Yes definitely.

[Rd] Minimum of an ordered factor

2011-01-05 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
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

[Rd] Avoid warning in a foreign package (maptools) when loaded via depends

2010-11-11 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hi everybody, Currently I'm in the process of developing an R library, where I make use of pointLabel in the maptools package. I've defined the dependency on package maptools via the DESCRIPTION file in the root directory of my library. Since the loading of package maptools issues a

[Rd] nlme: augPred.lme for factor covariates

2010-07-28 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hi everybody, as you may be aware the function augPred.lme does not work as soon as the covariate is a factor. The problem lies in the line newprimary - seq(from = minimum, to = maximum, length.out = length.out) which does not make sense for factors. I think augPred.lme can be useful for models

[Rd] Telling R CMD check where to find libraries

2010-07-20 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hello everybody, Currently I'm developing a library, which uses some functions from another package (namely plotrix). Consequently, I listed this dependency in the DESCRIPTION file. When I try to run R CMD check mypackage, the check fails, for the library plotrix cannot be found on the system. As

Re: [Rd] CHM help does not find help docs in package stats

2010-06-17 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: samedi 12 juin 2010 18:21 To: Thaler,Thorn,LAUSANNE,Applied Mathematics Cc: r-devel@r-project.org Subject: Re: [Rd] CHM help does not find help docs in package stats Which version of R is this? CHM help is R 2.10.0. All

[Rd] CHM help does not find help docs in package stats

2010-06-11 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hi all, currently I'm working on an R package bundling some frequently used functions. When I load my package and type ?one_of_my_functions I get the particular help file. If I try to get help on another function, which is part of package stats (prcomp say), I get This program cannot display