[R] Problem with line segments in a dotplot

Mitch Dawson MDawson at cihi.ca
Wed Mar 27 23:02:23 CET 2002


Hi,

I am trying to create a dotplot with dots (to represent a starting date) and
lines to represent a length of stay. The code below works except the line I
expect from the segments function.  Almost positive that this worked on
Splus in the past...

Any help would be greatly appreciated.

Mitch Dawson.

## using rw1041 -- windows

library(date)
library(lattice)

"ED" <-
structure(list(Resident.ID = c(490799, 490799, 490799, 490799, 
490799, 490799, 490975, 491024, 491454, 491509, 491663, 491663, 
491663, 491874, 492323, 492354, 492386, 492394, 492449, 492683
), AB1.Date.Of.Entry = structure(c(13370, 13509, 13583, 13629, 
13867, 13954, 13492, 14381, 13622, 13845, 14062, 14074, 14091, 
14014, 13976, 13358, 14285, 13815, 14332, 13886), class = "date"), 
    R4.Discharge.Date = structure(c(13379, 13523, 13588, 13635, 
    13880, 13958, 13513, 14494, 13631, 13883, 14066, 14090, 14101, 
    14040, 13982, 13360, 14384, 13843, 14364, 13901), class = "date")),
.Names = c("Resident.ID", 
"AB1.Date.Of.Entry", "R4.Discharge.Date"), row.names = c("1", 
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", 
"14", "15", "16", "17", "18", "19", "20"), class = "data.frame")

dotplot( Resident.ID ~ AB1.Date.Of.Entry, data=ED, col="black",
    panel=function(x,y, Discharge.Date=ED$R4.Discharge.Date, ...) { 
    panel.dotplot(x,y, ...)
    trellis.par.set( "dot.line", list(col="black",lty=2,lwd=1) )
    segments( x,y, Discharge.Date, y, col="black", lty=1, lwd=2 )
 } )
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list