[R] Superimposing y-variables in Lattice formulas

Stavros Macrakis macrakis at alum.mit.edu
Mon Nov 17 00:58:13 CET 2008


Deepayan,

Thanks again for your explanations.  I must admit I am still
struggling with some of these concepts (though I have in fact read
more than just help pages!), and I would be delighted to find a
holistic introduction to the concepts of formulae and of the lattice
system -- in fact I have ordered your book, which I imagine does
present a holistic introduction, and look forward to studying it.
Still, as both R and Lattice are free software, I'd have hoped to find
good documentation on-line.

On Sat, Nov 15, 2008 at 2:54 PM, Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
> a help page is intended to describe the capabilities of the function/object it is documenting, not the capabilities that are missing, even though those who have preconceived ideas of how certain things should behave often think that it is somehow the responsibility of the help page to anticipate all such misunderstandings.

According to the documentation, formulae are built using a variety of
operators, including ~, |, +, *, :, I, etc.  I'd have thought that a
function that takes a formula object as an argument would handle all
those operators in some reasonably consistent way, just as in a CAS
like Mathematica, one expects differentiation, integration, and series
expansion to work consistently on all formulae constructed with
standard operators such as +, *, ^, Sin, etc. Instead, what I find is
that the behavior is simply undocumented on the help page in many
cases.  For example:

     xyplot(conc*2~time*2,Indometh)

seems to (perfectly sensibly) plot 2*conc vs. 2*time -- though that
case is not mentioned in the help page -- whereas

     xyplot(conc+2~time+2,Indometh)

does something completely different and which as far as I can tell I
can't predict from the Help page.

Similarly, I have no clue what is going on with:

     xyplot(5+conc~time,Indometh)                    -- plots x=0 y=5
in red in addition to the regular plot
     xyplot(conc~time:Subject,Indometh)           -- values stacked at x ~ .25
     xyplot(conc~log(time):Subject,Indometh)    -- values stacked at x
~ -1.7, -.4, and .6
     xyplot(conc~time+5:Subject,Indometh)       -- ???
     z<-1:5; xyplot( z ~ z + 1 )                        -- red at
1/1,4/4,4/5,5/5; blue at 1/2,2/2,2/3,3/3,3/4

(some of) which give cryptic warnings (not errors) and produce some
sort of display.

The wording of the help page isn't very clear, either.  It says that
the formula is "generally" (meaning "usually"? or meaning "in
general"?) of a certain form and then goes on to describe various
other cases, with no conditioning variables, with algebraic
expressions instead of variables, with + instead of * (without saying
what the difference, if any, is), with plus signs on the left, with
the I operator, etc.

Thanks for your work on Lattice -- I look forward to mastering its
powerful features....

             -s



More information about the R-help mailing list