Hello! I would like to visualize the hospitalization within one year of several patients using a bar chart. For each patient the stay in a hospital should be illustrated with a dark colour a if there is a stay at home between 2 hopital stays, it should be illustrated with a bright colour. e.g. P1 |//////| |///| |////////| P2 |//////////| P3 |//| |////| |///| |//| Day1------------Day100---------------------------------Day365 legend: Px Patient with id x |///| Hospital stay (length of bar symbolizes length of stay) Place between 2 hospital stays symbolizes stay at home (not in hospital) Are there any package which can do that? If not, how can I implement this in R? Thanks a lot -- Stephan Spat Institute of Medical Technologies and Health Management JOANNEUM RESEARCH Forschungsgesellschaft mbH Elisabethstrasse 11a, 8010 Graz, AUSTRIA phone: +43 (0) 316 876-2157 fax: +43 (0) 316 876-2130 email: stephan.spat at joanneum.at homepage: http://www.joanneum.at/msg
If I undestand your question you can try something about like this: x <- matrix(rbinom(75, 1,.6), nc=3) image(x, col=c("gray", "white"), axes=F) axis(1, at=seq(0,1, l=nrow(x)), labels=paste("Day", 1:nrow(x))) axis(2, at=seq(0,1, l=ncol(x)), labels=paste("P", 1:3, sep="")) On 18/02/2008, Stephan Spat <stephan.spat at joanneum.at> wrote:> Hello! > > I would like to visualize the hospitalization within one year of several > patients using a bar chart. For each patient the stay in a hospital > should be illustrated with a dark colour a if there is a stay at home > between 2 hopital stays, it should be illustrated with a bright colour. > > e.g. > > P1 |//////| |///| |////////| > P2 |//////////| > P3 |//| |////| |///| |//| > Day1------------Day100---------------------------------Day365 > > > legend: > Px Patient with id x > |///| Hospital stay (length of bar symbolizes length of stay) > Place between 2 hospital stays symbolizes stay at home > (not in hospital) > > Are there any package which can do that? If not, how can I implement > this in R? > > Thanks a lot > > -- > Stephan Spat > > Institute of Medical Technologies and Health Management > JOANNEUM RESEARCH Forschungsgesellschaft mbH > Elisabethstrasse 11a, 8010 Graz, AUSTRIA > > phone: +43 (0) 316 876-2157 > fax: +43 (0) 316 876-2130 > email: stephan.spat at joanneum.at > homepage: http://www.joanneum.at/msg > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
Stephan Spat wrote:> Hello! > > I would like to visualize the hospitalization within one year of several > patients using a bar chart. For each patient the stay in a hospital > should be illustrated with a dark colour a if there is a stay at home > between 2 hopital stays, it should be illustrated with a bright colour. > > e.g. > > P1 |//////| |///| |////////| > P2 |//////////| > P3 |//| |////| |///| |//| > Day1------------Day100---------------------------------Day365 > > > legend: > Px Patient with id x > |///| Hospital stay (length of bar symbolizes length of stay) > Place between 2 hospital stays symbolizes stay at home > (not in hospital) > > Are there any package which can do that? If not, how can I implement > this in R?Hi Stephan, This looks very much like a Gantt chart with multiple time slots for each "task" (hospital stay). I've roughly programmed a function to do this, and I'll see if I can finish it off and send you a copy tomorrow. Jim