[R] different points and lines on the same plot

From: <antoniababe_at_yahoo.se>
Date: Sun 07 Jan 2007 - 14:08:52 GMT

Dear all,

I have following data called "paitent"

day patient1 patient4 patient5 patient6

0   -0.27842688 -0.04080808 -0.41948398 -0.04508318 
56  -0.22275425 -0.01767067 -0.30977249 -0.03168185  
112 -0.08217659 -0.26209243 -0.29141451 -0.09876170 
252 0.08044537 -0.26701769 0.05727087 -0.09663701

where each patient have response values at four time points. I want to plot each patient's values over time on the same plot where the value points are connected by line. That is, the graph will have four lines for the four patients. I tried the program below but couldn't make it work correctly. I'm new beginner and haven't yet learned how functions line and points work together. Hope you can help me out.

Thanks for your help,



        plot(patient[,1],patient[,2], pch=1, type="l",col=1,cex=1,lwd=2,

             xlab="Days", ylab="Patient
response",cex.main =1,font.main= 1,


points(patient[,1],patient[,3],col=2,pch=1,cex=1) lines(patient[,1],patient[,3],col=2,lty=1,cex=1)            

points(patient[,1],patient[,4],col=3,pch=1,cex=1) lines(patient[,1],patient[,4],col=2,lty=2,cex=1)        

points(patient[,1],patient[,5],col=4,pch=1,cex=1) lines(patient[,1],patient[,5],col=2,lty=1,cex=1)   points(patient[,1],patient[,6],col=5,pch=1,cex=1)  lines(patient[,1],patient[,6],col=2,lty=1,cex=1)

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 and provide commented, minimal, self-contained, reproducible code. Received on Mon Jan 08 06:53:30 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 07 Jan 2007 - 21:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.