[R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

Paul Miller pjmiller_57 at yahoo.com
Thu Mar 22 23:59:20 CET 2012

Hi Michael,

This may be an ugly way of doing things but the "title = unique(paste( ..." bit in the code below automates the code for pattern, patient, and line.

So now all I'd need is the looping part.

If good ways of automating the code for pattern, patient, and line or of doing the looping are apparent, please let me know. 



ggplot(TestData, aes(value, drug)) + geom_line(size = 6) + xlab("") + ylab("") + theme_bw() +
                 opts(title = unique(paste(TestData$pattern, "\n (profile_key = ", TestData$profile_key, ", line = ", TestData$line, ") \n" ) ) ) +
		     opts(axis.text.x = theme_blank() )

More information about the R-help mailing list