On 11/15/08, Stavros Macrakis <[EMAIL PROTECTED]> wrote:
> On Fri, Nov 14, 2008 at 6:55 PM, Deepayan Sarkar
>  <[EMAIL PROTECTED]> wrote:
>  >> ...But how do I specify that I want to display all the Subjects on a... 
> single graph, superimposing them all?
>
> >
>  > Have you tried
>  > xyplot ( conc ~ time , Indometh, groups = Subject ) ?
>
>
> Thanks very much for your help!  That works beautifully.
>
>  Any particular reason this can't be specified in the formula?  For a

Mostly historical, but the 'groups' approach makes the design cleaner
and more generalizable, although that fact is difficult to appreciate
without some experience.

>  small number of levels, you can write
>
>     xyplot( ifelse(Subject==1,conc,NA) + ifelse(Subject==2,conc,NA) ~ time, 
> ...)
>
>  but obviously that doesn't generalize.  I'd have thought that
>  something like conc*Subject or (conc | Subject) should mean the same
>  thing, but these aren't allowed for some reason. But I don't know what
>  the semantics of the formula operators are.  Neither the 'formula' nor
>  the 'logic' man page even defines `|`, and the 'xyplot' man page only
>  gives examples, not a definition of the general case: "the formula is
>  generally of the form... can also be supplied as ... a special case is
>  ...".

There is no general interpretation for a "formula", it is always
function-specific. I consider the part of the help page you quoted
(without the omissions) a completely general description of the
formula as applicable to xyplot():

  " The formula is generally of the form 'y ~ x | g1 * g2 * ...'  "

(along with a later paragraph documenting the special interpretation of '+' ).

Note that 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.

If you want a holistic introduction to a suite of tools like lattice,
function documentation (which is by definition function-centric) is
not the best place to look.

-Deepayan

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to