Re: [R] lattice panel.lmline problem

2007-09-10 Thread Frede Aakmann Tøgersen
Why not use the more simple

xyplot(total.fat~x|variable,groups=Group,
   data=tmp1,type=c(p,r))

???

See ?panel.xyplot and especially the type argument of that panel function.




Best regards

Frede Aakmann Tøgersen
Scientist


UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers Allé 20, P.O. BOX 50
DK-8830 Tjele

Phone:   +45 8999 1900
Direct:  +45 8999 1878

E-mail:  [EMAIL PROTECTED]
Web:   http://www.agrsci.org

This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of 
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural 
Sciences immediately and delete this email.


 

 -Oprindelig meddelelse-
 Fra: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] På vegne af Ross Darnell
 Sendt: 10. september 2007 07:55
 Til: r-help@stat.math.ethz.ch
 Emne: [R] lattice panel.lmline problem
 
 I am wanting to generate panels showing scatterplots with the 
 linear fitted line for two groups within each panel superimposed.
 
 I have two conditioning factors, variable and Group and I 
 want separate panels for each level of variable
 
 with different symbols and lmlines for each level of 
 Group. However all observations for a group are missing for 
 some variables so I would still like the points and lmline 
 for the observed group plotted for that variable(panel).
 
  
 
 My attempt is 
 
  
 
 print(xyplot(total.fat~x|variable,data=tmp1,subscripts=TRUE,
 
  
 scales=list(x=list(relation=free)),xlab=,groups=Group,
 
  panel=function(x,y,subscripts,...){
 
panel.superpose(x,y,subscripts,...)
 
if(length(x[subscripts])!=0)
 
  
 {panel.superpose(x,y,panel.groups=panel.lmline,subscripts,...)}}))
 
  
 
 Which gives an error
 
  
 
 Error in lm.fit(x, y, offset = offset, singular.ok = 
 singular.ok, ...) :
 
 
 0 (non-NA) cases
 
  
 
  
 
 Which occurs when the first panel with all values for one 
 group are missing.
 
 The same error is returned if I replace the last line without the if
 statement which obviously means it's ignored.
 
  
 
 Of course I may be taking the wrong tack completely to get 
 the result I need. Any advice would be appreciated
 
   
 
  
 
 Ross Darnell
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch 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.


__
R-help@stat.math.ethz.ch 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.


Re: [R] lattice panel.lmline problem

2007-09-10 Thread Ross Darnell
Thanks Frede

I didn't know about the r type. 

Ross Darnell


-Original Message-
From: Frede Aakmann Tøgersen [mailto:[EMAIL PROTECTED]
Sent: Mon 10-Sep-07 4:45 PM
To: Ross Darnell; r-help@stat.math.ethz.ch
Subject: SV: [R] lattice panel.lmline problem
 
Why not use the more simple

xyplot(total.fat~x|variable,groups=Group,
   data=tmp1,type=c(p,r))

???

See ?panel.xyplot and especially the type argument of that panel function.




Best regards

Frede Aakmann Tøgersen
Scientist


UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers Allé 20, P.O. BOX 50
DK-8830 Tjele

Phone:   +45 8999 1900
Direct:  +45 8999 1878

E-mail:  [EMAIL PROTECTED]
Web:   http://www.agrsci.org

This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of 
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural 
Sciences immediately and delete this email.


 

 -Oprindelig meddelelse-
 Fra: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] På vegne af Ross Darnell
 Sendt: 10. september 2007 07:55
 Til: r-help@stat.math.ethz.ch
 Emne: [R] lattice panel.lmline problem
 
 I am wanting to generate panels showing scatterplots with the 
 linear fitted line for two groups within each panel superimposed.
 
 I have two conditioning factors, variable and Group and I 
 want separate panels for each level of variable
 
 with different symbols and lmlines for each level of 
 Group. However all observations for a group are missing for 
 some variables so I would still like the points and lmline 
 for the observed group plotted for that variable(panel).
 
  
 
 My attempt is 
 
  
 
 print(xyplot(total.fat~x|variable,data=tmp1,subscripts=TRUE,
 
  
 scales=list(x=list(relation=free)),xlab=,groups=Group,
 
  panel=function(x,y,subscripts,...){
 
panel.superpose(x,y,subscripts,...)
 
if(length(x[subscripts])!=0)
 
  
 {panel.superpose(x,y,panel.groups=panel.lmline,subscripts,...)}}))
 
  
 
 Which gives an error
 
  
 
 Error in lm.fit(x, y, offset = offset, singular.ok = 
 singular.ok, ...) :
 
 
 0 (non-NA) cases
 
  
 
  
 
 Which occurs when the first panel with all values for one 
 group are missing.
 
 The same error is returned if I replace the last line without the if
 statement which obviously means it's ignored.
 
  
 
 Of course I may be taking the wrong tack completely to get 
 the result I need. Any advice would be appreciated
 
   
 
  
 
 Ross Darnell
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch 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.
 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] lattice panel.lmline problem

2007-09-10 Thread Deepayan Sarkar
On 9/10/07, Ross Darnell [EMAIL PROTECTED] wrote:
 Thanks Frede

 I didn't know about the r type.

For the record, this is probably what you wanted:

xyplot(...
   panel = panel.superpose,
   panel.groups = function(x, y, ...) {
   panel.xyplot(x, y, ...)
   if (length(x)  0) panel.lmline(x, y, ...)
   })

x[subscripts] inside the panel function doesn't give anything
meaningful ('x' is already subscripted).

-Deepayan



 Ross Darnell


 -Original Message-
 From: Frede Aakmann Tøgersen [mailto:[EMAIL PROTECTED]
 Sent: Mon 10-Sep-07 4:45 PM
 To: Ross Darnell; r-help@stat.math.ethz.ch
 Subject: SV: [R] lattice panel.lmline problem

 Why not use the more simple

 xyplot(total.fat~x|variable,groups=Group,
data=tmp1,type=c(p,r))

 ???

 See ?panel.xyplot and especially the type argument of that panel function.

[...]

__
R-help@stat.math.ethz.ch 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.


[R] lattice panel.lmline problem

2007-09-09 Thread Ross Darnell
I am wanting to generate panels showing scatterplots with the linear
fitted line for two groups within each panel superimposed.

I have two conditioning factors, variable and Group and I want
separate panels for each level of variable

with different symbols and lmlines for each level of Group. However
all observations for a group are missing for some variables so I would
still like the points and lmline for the observed group plotted for that
variable(panel).

 

My attempt is 

 

print(xyplot(total.fat~x|variable,data=tmp1,subscripts=TRUE,

 scales=list(x=list(relation=free)),xlab=,groups=Group,

 panel=function(x,y,subscripts,...){

   panel.superpose(x,y,subscripts,...)

   if(length(x[subscripts])!=0)

 
{panel.superpose(x,y,panel.groups=panel.lmline,subscripts,...)}}))

 

Which gives an error

 

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :


0 (non-NA) cases

 

 

Which occurs when the first panel with all values for one group are
missing.

The same error is returned if I replace the last line without the if
statement which obviously means it's ignored.

 

Of course I may be taking the wrong tack completely to get the result I
need. Any advice would be appreciated

  

 

Ross Darnell


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.