Re: [Rd] improved pairs.formula?

From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>
Date: Tue 29 Mar 2005 - 08:00:23 GMT

Dear Brian,

>>>>> "BDR" == Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:

    BDR> On Tue, 29 Mar 2005, Berwin A Turlach wrote:
>> Dear all,
>>
>> I would like to suggest changing the pairs.formula command such
>> that a command like
>> [...]

    BDR> Perhaps you could explain what precisely 'the job' is Sorry, for not making it clear enough, must be that English is my second language. What I meant is, that with the above definition of pairs.formula a command like

        pairs(GNP ~ . - Year - GNP.deflator, longley) would only produce a pairwise scatterplot of GNP and all other variables in the dataframe except for Year and GNP.deflator. And, incidentally, so would

        pairs( ~ . - Year - GNP.deflator, longley)

    BDR> and why you chose such an unusual piece of code to do it? Mmh, I don't think of it as being so unusual, most of it was gleaned from other R function. Well, I realise that R programing paradigms change over the years, so I must have gotten them from quite old routine.

    BDR> (E.g. what is the prescription for the ordering of terms, and
    BDR> why do you think the rownames of the factors and the
    BDR> variables might be in different orders?  They are set the
    BDR> same in the C code.)

In case that a user foolishly specifies a more complicated formula having not read the help pages. It seemed to me that this was the only construct to figure out which variables are actually appearing in
terms of the formula.

    BDR> BTW, the help page specifically warns against a formula of     BDR> the type you specified.
Does it? I searched the help page (R 2.0.1) for `.' and couldn't find anything about not using it in a formula. But then, again, perhaps I missed something with English being my second language......

    BDR> Why do you want to allow a response? Why not, the current version allows it too. At least the help page in my version of R states:

        (A response will be interpreted as another variable, but not
        treated specially, so it is confusing to use one.)

Actually, I noticed that the response variable will always be in the top row, so it is treated specially. Try it out and compare:

> pairs(longley)
> pairs(GNP ~ ., longley)

    BDR> Currently only '+' is documented to work. The help page for pairs in my version of R states:

 formula: a formula, such as '~ x + y + z'. Each term will give a

          separate variable in the pairs plot, so terms should be
          numeric vectors.  (A response will be interpreted as another
          variable, but not treated specially, so it is confusing to
          use one.)

I don't interpret this as "only '+' is documented to work". For me this is just an example of an allowed formula, but an exhaustive listing of those formulas that are allowed. But then, despite the danger of repeating myself, English is only my second language....

Best wishes,

        Berwin


R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Mar 29 18:03:56 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:02 GMT