I am probably missing something quite obvious, but any help would be
appreciated. I am continually getting people misreading the lattice plots
because they are expecting the strip (with the factor names in them) to be
below the graph. Is there anyway of achieving this.
 
Secondly, from a more personal note I find the grid formed by the axes to be
a bit overpowering and would like to make it a little less bold by changing
it to a grey of some kind. I can't see that the scales options have anythig
in their that I could use. I can change the label colours and tick marks,
but then I draw a blank.
 
While I'm on a role, I find that quite often I have to resort to the at and
label sections of the scales function to get my tickmarks looking OK. This
seems to be when  am producing line graphs with one of the scales being a
date (POSIXct). What is not clear to me is if all POSIXct variables are the
same. The xyplot doco indicates that the at co-ordinates should be native
co-ordinates. Can anyone point me to where in the voluminous documentation
one looks to understand what this means. I have found that on some occasions
the co-ordinates are in seconds (as the documentation on POSIXct states, but
this afternoon I found that the values seemed to be in years. Which wasn't a
problem other than I wish I could understand what was actually happening.
 
For the "years" example, when the data is originally imported the years came
in as integers.
 
 
 
str(rbd)
      `data.frame':   541 obs. of  6 variables:
      $ Year    : int  1993 1994 1995 1996 1997 1998 1999 2000 2001 1993 ...
      $ Hosp    : Factor w/ 75 levels "ALBANY HOSP..",..: 23 23 23 23 23 23
23 23 23 28 ...
      $ Beddays : int  2431 2507 2201 2985 2702 2461 2535 2970 3271 1246 ...
      $ HD      : Factor w/ 21 levels "Avon HD.","Bunb..",..: 10 10 10 10 10
10 10 10 10 10 ...
      $ HR      : Factor w/ 6 levels "Goldfields-..",..: 3 3 3 3 3 3 3 3 3 3
...
      $ HospCode: int  127 127 127 127 127 127 127 127 127 128 ...
 
Thinking that I needed a date I promptly put
 
     rbd$Year <- as.POSIXct(ISOdate(rbd$Year,6,30))

then onwards and forwards
 
for (h in levels(rbd$HR)){
 HRData <- subset(rbd,HR==h)
 HRData$CommnDesc <- HRData$CommnDesc[,drop=T]
 temp <-c((FormatLabels(levels(HRData$CommnDesc)[1],20)))
 for (j in 2:length(levels(HRData$CommnDesc))){
   temp <- c(temp,FormatLabels(levels(HRData$CommnDesc)[j],20))
  }
 levels(HRData$CommnDesc) <- temp
 
p1 <-  bwplot(Beddays~Year |CommnDesc,HRData,
       panel = "panel.linejoin",
       horizontal=F,bty="n",
       as.table=T,
       par.strip.text=list(lines=3.5,cex=0.8,style=1),
       main=paste(h,"Inpatient Beddays"),
       scales=list(x=list(cex=0.8,rot=90,
       at=c(2,6,9),
       labels=c("94","98","01"),col="navy"))
)
print(p1)
savePlot(file=paste(OutputPath,"Inpatient beddays -(lattice) by region",h,"
",j,sep=""),type="wmf")
}

Of course there are a few things in here that are probably not the right way
to do things, but I tend to be more interested in the output, rather than
whether or not my programming is up to speed. But it has been a little bug
bear of mine about dropping factors when subsetting the data. I've noticed
subset options as I've been going through assorted bits and pieces, but
there never seems to be enough time to follow up.
 
This is in striking contrast to a previous attempt (most of the code however
is at home not here), but the functions that I worked out for the at and
label functions were
 
ProcLab <- function(DateData,breakNum){
 maxplot <- round(as.numeric(max(DateData)),digits=0)
 minplot <- round(as.numeric(min(DateData)),digits=0)
 maxplotnum<- round(((maxplot-minplot)/86400)+1,digits=0)
 jumpnum <- (maxplotnum/((breakNum)-1))*.98
   lablist <- seq(min(DateData),max(DateData),jumpnum*86400)
}
 
ProcAt <- function(DateData,breakNum){
 maxplot <- round(as.numeric(max(DateData)),digits=0)
 minplot <- round(as.numeric(min(DateData)),digits=0)
 maxplotnum<- round(((maxplot-minplot)/86400)+1,digits=0)
 jumpnum <- (maxplotnum/((breakNum)-1))*.98
 atlist <- seq(0,maxplotnum,jumpnum) 
}
 
The kludges were in because without them the whole thing fell over,
presumeably because I would needed to have set the limits as well.
 

 
_________________________________________________
 
Tom Mulholland
Senior Policy Officer
WA Country Health Service
189 Royal St, East Perth, WA, 6004
 
Tel: (08) 9222 4062
e-mail: Tom.Mulholland@health.wa.gov.au
<mailto:Tom.Mulholland@health.wa.gov.au> 
 
The contents of this e-mail transmission are confidential and may be
protected by professional privilege. The contents are intended only for the
named recipients of this e-mail. If you are not the intended recipient, you
are hereby notified that any use, reproduction, disclosure or distribution
of the information contained in this e-mail is prohibited. Please notify the
sender immediately.
 

	[[alternate HTML version deleted]]


