[R] Re: new sep argument for interaction

Martin Maechler maechler at stat.math.ethz.ch
Thu Aug 5 10:09:52 CEST 2004


>>>>> "Gabor" == Gabor Grothendieck <ggrothendieck at myway.com>
>>>>>     on Thu, 5 Aug 2004 00:15:25 +0000 (UTC) writes:

    Gabor> Deepayan Sarkar <deepayan <at> stat.wisc.edu> writes:
    Gabor> : 
    Gabor> : On Wednesday 04 August 2004 15:50, Gabor Grothendieck wrote:
    Gabor> : 
    Gabor> : > Several people have already mentioned paste, which returns a
    Gabor> : > character result, and two other solutions, depending on what you are
    Gabor> : > looking for, are:
    Gabor> : >
    Gabor> : >    with(tenn, 100 * up + 10 * down + stable)  # numeric result
    Gabor> : >
    Gabor> : >    with(tenn, interaction(up, down, stable, sep =""))  # factor
    Gabor> : > result
    Gabor> : 
    Gabor> : Except that interaction doesn't have a sep= argument. 

    Gabor> The interaction in Hmisc has a sep= argument.  (I did
    Gabor> ?interaction before posting but forgot that I had
    Gabor> Hmisc loaded and did not notice that I was looking at
    Gabor> the help for Hmisc interaction rather than the base
    Gabor> interaction.)

    Gabor> Thus, just to be definite, the above should have been:

    Gabor> require(Hmisc)
    Gabor> with(tenn, interaction(up, down, stable, sep = ""))

I apologize to Frank, but the fact that 'Hmisc' redefines
standard R functions {the "[.factor" redefinition being much
more problematic, and yes, "library(Hmisc)" now warns about it}
is one reason I'm sometimes recommending not to use it at all
even though I know about its many very nice pearls inside!
If there only was an 'Hmisc' version without any of these
redefinitions -- it would be one of my most recommended packages
(apart from the officially "Recommended" ones) !

Yes, I agree with Deepayan's suggestion that R's interaction()
function should grow a "sep" argument --- and I am adding it
*now*.

Martin Maechler




More information about the R-help mailing list