Hi Dave,
Try using paste within main i.e.
x=rnorm(100)
y=runif(100)
k=sample(1:10,10, replace=T)
for(i in k){
plot(x,y, xlab=gamma, ylab=r1, main=paste(Patient, i, sep= ))
Sys.sleep(1)
}
In this eaxmple I am just plotting the same x,y values on each figure but
you can easily plot the observations for each patient by subetting your data
by the K variable. See ?[ for more details on subsetting.
I hope this helps
Francisco
Dr. Francisco J. Zagmutt
College of Veterinary Medicine and Biomedical Sciences
Colorado State University
From: Afshartous, David [EMAIL PROTECTED]
To: Afshartous, David [EMAIL PROTECTED],
r-help@stat.math.ethz.ch
Subject: [R] supplying dynamic main argument to plot?
Date: Tue, 27 Jun 2006 16:19:12 -0400
All,
Simple question but I don't seem to be able to find the answer in the
documentation:
When using plot within a loop, is there any way to supply the argument
to main dynamically,
i.e., so that the title is Patient k below as the loop cycles through
each value of k?
plot(x,y, xlim=c(0,250), ylim=c(0,1000), xlab=gamma, ylab=r1,
main=Patient k)
thanks
dave
ps - I'm running windows.
[[alternative HTML version deleted]]
__
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
__
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