RE: [R] Combining numeric vs numeric numeric vs factor graphs into one ps/pdf file

2005-05-05 Thread Arenas, David R. CIV NAVAIR DEPT
Deepayan,

Thank you for your response.  I tried your suggestion to manually specify the 
y-axis label for the factor but I am stuck.  My attempt is below.  I once again 
appreciate any input as well as your time.  lattice/R-project is great.

Thanks once again,

David Arenas

# Example dataframe
test.df - data.frame(acft=factor(c(A,B,C,D)),
  status=factor(c(fail,pass,fail,pass)), 
  site=factor(c(E1,E1,E2,E2)),
  CD=as.numeric(c(1,1,3,3)),
  H=as.numeric(c(80,NA,60,NA)))

# Your previous suggestion
xyplot(ifelse(status==pass, as.numeric(site), H) ~ CD| acft,
   data=test.df,
   scales=free,
   xlim=c(0,4))

# My attempt to manually adjust the y-axis label for the factor site
# site has E1  E2 that are read as 1 and 2, so I am trying to adjust
# the ylim for acft B and D to c(0,2) but I get an error
xyplot(ifelse(status==pass, as.numeric(site), H) ~ CD| acft,
   data=test.df,
   scales=free,
   prepanel=function(x,y) {
ylim - if(test.df$status==pass) 2 else 90
list(xlim=range(0:4),
 ylim=range(0:ylim)) }  ) 


-Original Message-
From: Deepayan Sarkar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 03, 2005 19:59
To: r-help@stat.math.ethz.ch
Cc: Arenas, David R. CIV NAVAIR DEPT
Subject: Re: [R] Combining numeric vs numeric  numeric vs factor graphs
into one ps/pdf file


On Tuesday 03 May 2005 10:44, Arenas, David R.  CIV NAVAIR DEPT wrote:
 Dear R community,

 My previous email was incomplete because I used html format.  Here it
 is again and sorry for any inconvenience:

 xyplot (lattice) has been great in displaying tons of data for my
 research.  I have used the following two xyplot commands (with
 example dataframe) to create two separate postscript/pdf files with
 respect to the variable acft and subset status:

 test.df - data.frame(acft=factor(c(A,B,C,D)),
  
 status=factor(c(fail,pass,fail,pass)),
 site=factor(c(E1,E1,E2,E2)), CD=as.numeric(c(1,1,3,3)),
   H=as.numeric(c(80,NA,60,NA)))

 xyplot(H ~ CD | acft,
   data=test.df,
   subset=status==fail,
   layout=c(1,1) )

 xyplot(site ~ CD | acft,
   data=test.df,
   subset=status==pass,
   layout=c(1,1) )

  I would like to combine all graphs into one file in alphabetical
 order of variable acft.  The graphs would be one per page where in
 fact I use layout=c(1,1) for the nice and easily seen strip labels
 for acft.  The problem I am having is combining x-y plots that are
 numeric vs numeric  numeric vs factor.  I have search the R-help
 archives and R-project references for an example to no avail.  I am
 thinking I may have to use something (lattice or not) like ...

 if any(test.df$Status==fail)
 plot(H ~ CD)
 else
 plot(site ~ CD)

 with for in the beginning to loop through all data with respect to
 acft.  I need a hint on how to further this along.  I am using
 R.2.1.0 via Windows XP.

I can't think of a clean way to do this. You could of course do 

xyplot(ifelse(status == pass, as.numeric(site), H) ~ CD| acft,
   data=test.df, scales = free,
   layout=c(1,1) )

but this wouldn't give very nice axis labels for the factor (unless you 
specify them manually, which could be done).

Deepayan

__
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


Re: [R] Combining numeric vs numeric numeric vs factor graphs into one ps/pdf file

2005-05-03 Thread Arenas, David R. CIV NAVAIR DEPT
Dear R community,

My previous email was incomplete because I used html format.  Here it is again 
and sorry for any inconvenience:

xyplot (lattice) has been great in displaying tons of data for my research.  I 
have used the following two xyplot commands (with example dataframe) to create 
two separate postscript/pdf files with respect to the variable acft and 
subset status:

test.df - data.frame(acft=factor(c(A,B,C,D)),
  status=factor(c(fail,pass,fail,pass)),
  site=factor(c(E1,E1,E2,E2)),
  CD=as.numeric(c(1,1,3,3)),
  H=as.numeric(c(80,NA,60,NA)))

xyplot(H ~ CD | acft,
  data=test.df,
  subset=status==fail,
  layout=c(1,1) )

xyplot(site ~ CD | acft,
  data=test.df,
  subset=status==pass,
  layout=c(1,1) )

 I would like to combine all graphs into one file in alphabetical order of 
variable acft.  The graphs would be one per page where in fact I use 
layout=c(1,1) for the nice and easily seen strip labels for acft.  The 
problem I am having is combining x-y plots that are numeric vs numeric  
numeric vs factor.  I have search the R-help archives and R-project references 
for an example to no avail.  I am thinking I may have to use something (lattice 
or not) like ...

if any(test.df$Status==fail)
plot(H ~ CD)
else
plot(site ~ CD)

with for in the beginning to loop through all data with respect to acft.  I 
need a hint on how to further this along.  I am using R.2.1.0 via Windows XP.

Thank you for any help,

D. Arenas

[[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


Re: [R] Combining numeric vs numeric numeric vs factor graphs into one ps/pdf file

2005-05-03 Thread David Hugh-Jones
Hi David

You probably want to write your own panel function and pass it into
xyplot(). Something like

mypanel - function (x,y, groups, subscripts) {
  if (status[subscripts] == pass) {
panel.xyplot(H,CD)
  }
  else {
 panel.xyplot(site, CD)
  }
}

Check out the groups and subscripts arguments to xyplot.

cheers
Dave

On 03/05/05, Arenas, David R.  CIV NAVAIR DEPT [EMAIL PROTECTED] wrote:
 Dear R community,

 My previous email was incomplete because I used html format.  Here it is 
 again and sorry for any inconvenience:

 xyplot (lattice) has been great in displaying tons of data for my research.  
 I have used the following two xyplot commands (with example dataframe) to 
 create two separate postscript/pdf files with respect to the variable acft 
 and subset status:

 test.df - data.frame(acft=factor(c(A,B,C,D)),
   status=factor(c(fail,pass,fail,pass)),
   site=factor(c(E1,E1,E2,E2)),
   CD=as.numeric(c(1,1,3,3)),
   H=as.numeric(c(80,NA,60,NA)))

 xyplot(H ~ CD | acft,
   data=test.df,
   subset=status==fail,
   layout=c(1,1) )

 xyplot(site ~ CD | acft,
   data=test.df,
   subset=status==pass,
   layout=c(1,1) )

  I would like to combine all graphs into one file in alphabetical order of 
 variable acft.  The graphs would be one per page where in fact I use 
 layout=c(1,1) for the nice and easily seen strip labels for acft.  The 
 problem I am having is combining x-y plots that are numeric vs numeric  
 numeric vs factor.  I have search the R-help archives and R-project 
 references for an example to no avail.  I am thinking I may have to use 
 something (lattice or not) like ...

 if any(test.df$Status==fail)
 plot(H ~ CD)
 else
 plot(site ~ CD)

 with for in the beginning to loop through all data with respect to acft.  I 
 need a hint on how to further this along.  I am using R.2.1.0 via Windows XP.

 Thank you for any help,

 D. Arenas

 [[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


__
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


Re: [R] Combining numeric vs numeric numeric vs factor graphs into one ps/pdf file

2005-05-03 Thread Deepayan Sarkar
On Tuesday 03 May 2005 10:44, Arenas, David R.  CIV NAVAIR DEPT wrote:
 Dear R community,

 My previous email was incomplete because I used html format.  Here it
 is again and sorry for any inconvenience:

 xyplot (lattice) has been great in displaying tons of data for my
 research.  I have used the following two xyplot commands (with
 example dataframe) to create two separate postscript/pdf files with
 respect to the variable acft and subset status:

 test.df - data.frame(acft=factor(c(A,B,C,D)),
  
 status=factor(c(fail,pass,fail,pass)),
 site=factor(c(E1,E1,E2,E2)), CD=as.numeric(c(1,1,3,3)),
   H=as.numeric(c(80,NA,60,NA)))

 xyplot(H ~ CD | acft,
   data=test.df,
   subset=status==fail,
   layout=c(1,1) )

 xyplot(site ~ CD | acft,
   data=test.df,
   subset=status==pass,
   layout=c(1,1) )

  I would like to combine all graphs into one file in alphabetical
 order of variable acft.  The graphs would be one per page where in
 fact I use layout=c(1,1) for the nice and easily seen strip labels
 for acft.  The problem I am having is combining x-y plots that are
 numeric vs numeric  numeric vs factor.  I have search the R-help
 archives and R-project references for an example to no avail.  I am
 thinking I may have to use something (lattice or not) like ...

 if any(test.df$Status==fail)
 plot(H ~ CD)
 else
 plot(site ~ CD)

 with for in the beginning to loop through all data with respect to
 acft.  I need a hint on how to further this along.  I am using
 R.2.1.0 via Windows XP.

I can't think of a clean way to do this. You could of course do 

xyplot(ifelse(status == pass, as.numeric(site), H) ~ CD| acft,
   data=test.df, scales = free,
   layout=c(1,1) )

but this wouldn't give very nice axis labels for the factor (unless you 
specify them manually, which could be done).

Deepayan

__
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


[R] Combining numeric vs numeric numeric vs factor graphs into one ps/pdf file

2005-05-02 Thread Davaren1
Dear R community,
 
 xyplot (lattice) has been great in displaying tons of data for my research.  
I have used the following two xyplot commands (with example dataframe) to 
create two separate postscript/pdf files with respect to the variable acft 
and 
subset status:
 
test.df 

[[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