hi,
is there any wait function in R. I am running one R script to plot
many graphs it is in the for loop. its showing no error but its not
plotting well I think i can solve this problem with a wait function.
Please help me in this regards. If u need any clarification about
programme. u can find the script below.
best regards,
Deepak.M.R
Biocomputing Group
University of Bologana.
#!/usr/bin/R
s<-c("GG","GA","GV","GL","GI","GM","GF","GW","GP","GS","GT","GC","GY","GN","GQ","GD","GE","GK","GR","GH","AA","AV","AL","AI","AM","AF","AW","AP","AS","AT","AC","AY","AN","AQ","AD","AE","AK","AR","AH","VV","VL","VI","VM","VF","VW","VP","VS","VT","VC","VY","VN","VQ","VD","VE","VK","VR","VH","LL","LI","LM","LF","LW","LP","LS","LT","LC","LY","LN","LQ","LD","LE","LK","LR","LH","II","IM","IF","IW","IP","IS","IT","IC","IY","IN","IQ","ID","IE","IK","IR","IH","MM","MF","MW","MP","MS","MT","MC","MY","MN","MQ","MD","ME","MK","MR","MH","FF","FW","FP","FS","FT","FC","FY","FN","FQ","FD","FE","FK","FR","FH","WW","WP","WS","WT","WC","WY","WN","WQ","WD","WE","WK","WR","WH","PP","PS","PT","PC","PY","PN","PQ","PD","PE","PK","PR","PH","SS","ST","SC","SY","SN","SQ","SD","SE","SK","SR","SH","TT","TC","TY","TN","TQ","TD","TE","TK","TR","TH","CC","CY","CN","CQ","CD","CE","CK","CR","CH","YY","YN","YQ","YD","YE","YK","YR","YH","NN","NQ","ND","NE","NK","NR","NH","QQ","QD","QE","QK","QR","QH","DD","DE","DK","DR","DH","EE","EK","ER","EH","KK","KR","KH","RR","RH","HH")
for(t in 1:length(s))
{
a<-read.table(paste("../All_alpha_proteins/alp",s[t],"mean.sat",sep=""),header=T)
attach (a)
names(a)
al<-1:length(paste("alp",s[t],"_mean",sep=""))
b<-read.table(paste("../All_beta_proteins/bet",s[t],"mean.sat",sep=""),header=T)
attach(b)
names(b)
bl<-1:length(paste("bet",s[t],"_mean",sep=""))
p<-read.table(paste("../Alpha_and_beta_proteins_a+b/apb",s[t],"mean.sat",sep=""),header=T)
attach(p)
names(p)
pl<-1:length(paste("apb",s[t],"_mean",sep=""))
o<-read.table(paste("../Alpha_and_beta_proteins_aorb/aob",s[t],"mean.sat",sep=""),header=T)
attach(o)
names(o)
ol<-1:length(paste("aob",s[t],"_mean",sep=""))
postscript(file=paste("Mean_",s[t],"_Plot.ps",sep=""))
plot(0,xlim=c(0,160),ylim=c(0,70),main=paste("Mean Distance Plot for
",s[t]," Rsidue pair",sep=""),ylab="Mean Distance
in
Angstrom",xlab="Residue Seperation Number")
lines(al,paste("alp",s[t],"_mean",sep=""),col="blue",lty
= 2)
lines(bl,paste("bet",s[t],"_mean",sep=""),col="yellow",lty
= 2)
lines(pl,paste("apb",s[t],"_mean",sep=""),col="red",lty
= 2)
lines(ol,paste("aob",s[t],"_mean",sep=""),col="green",lty
= 2)
legend("topleft",c("Alpha Proteins","Beta
Proteins","Alpha +
Beta","Alpha or Beta"),lty
c(2,2,2,2),col=c("blue","yellow","red","green"))
dev.off()
}
Dear Deepak,
You'll need to clarify what EXACTLY is happening? If empty plots are
created then try to wrap the plot() in print() statements.
print(plot(...)).
Furthermore I would recommend to avoid attach.
HTH,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens deepak m r
Verzonden: dinsdag 14 juli 2009 13:17
Aan: r-help at r-project.org
Onderwerp: [R] hi friends, is there any wait function in R
hi,
is there any wait function in R. I am running one R script to plot
many graphs it is in the for loop. its showing no error but its not
plotting well I think i can solve this problem with a wait function.
Please help me in this regards. If u need any clarification about
programme. u can find the script below.
best regards,
Deepak.M.R
Biocomputing Group
University of Bologana.
#!/usr/bin/R
s<-c("GG","GA","GV","GL","GI","GM","GF","GW","GP","GS","GT","GC","GY","G
N","GQ","GD","GE","GK","GR","GH","AA","AV","AL","AI","AM","AF","AW","AP"
,"AS","AT","AC","AY","AN","AQ","AD","AE","AK","AR","AH","VV","VL","VI","
VM","VF","VW","VP","VS","VT","VC","VY","VN","VQ","VD","VE","VK","VR","VH
","LL","LI","LM","LF","LW","LP","LS","LT","LC","LY","LN","LQ","LD","LE",
"LK","LR","LH","II","IM","IF","IW","IP","IS","IT","IC","IY","IN","IQ","I
D","IE","IK","IR","IH","MM","MF","MW","MP","MS","MT","MC","MY","MN","MQ"
,"MD","ME","MK","MR","MH","FF","FW","FP","FS","FT","FC","FY","FN","FQ","
FD","FE","FK","FR","FH","WW","WP","WS","WT","WC","WY","WN","WQ","WD","WE
","WK","WR","WH","PP","PS","PT","PC","PY","PN","PQ","PD","PE","PK","PR",
"PH","SS","ST","SC","SY","SN","SQ","SD","SE","SK","SR","SH","TT","TC","T
Y","TN","TQ","TD","TE","TK","TR","TH","CC","CY","CN","CQ","CD","CE","CK"
,"CR","CH","YY","YN","YQ","YD","YE","YK","YR","YH","NN","NQ","ND","NE","
NK","NR","NH","QQ","QD","QE","QK","QR","QH","DD","DE"!
,"DK","DR","DH","EE","EK","ER","EH","KK","KR","KH","RR","RH","HH")
for(t in 1:length(s))
{
a<-read.table(paste("../All_alpha_proteins/alp",s[t],"mean.sat",sep=""),
header=T)
attach (a)
names(a)
al<-1:length(paste("alp",s[t],"_mean",sep=""))
b<-read.table(paste("../All_beta_proteins/bet",s[t],"mean.sat",sep=""),h
eader=T)
attach(b)
names(b)
bl<-1:length(paste("bet",s[t],"_mean",sep=""))
p<-read.table(paste("../Alpha_and_beta_proteins_a+b/apb",s[t],"mean.sat"
,sep=""),header=T)
attach(p)
names(p)
pl<-1:length(paste("apb",s[t],"_mean",sep=""))
o<-read.table(paste("../Alpha_and_beta_proteins_aorb/aob",s[t],"mean.sat
",sep=""),header=T)
attach(o)
names(o)
ol<-1:length(paste("aob",s[t],"_mean",sep=""))
postscript(file=paste("Mean_",s[t],"_Plot.ps",sep=""))
plot(0,xlim=c(0,160),ylim=c(0,70),main=paste("Mean Distance Plot
for ",s[t]," Rsidue pair",sep=""),ylab="Mean
Distance in
Angstrom",xlab="Residue Seperation Number")
lines(al,paste("alp",s[t],"_mean",sep=""),col="blue",lty
= 2)
lines(bl,paste("bet",s[t],"_mean",sep=""),col="yellow",lty
= 2)
lines(pl,paste("apb",s[t],"_mean",sep=""),col="red",lty
= 2)
lines(ol,paste("aob",s[t],"_mean",sep=""),col="green",lty
= 2)
legend("topleft",c("Alpha Proteins","Beta
Proteins","Alpha +
Beta","Alpha or Beta"),lty
c(2,2,2,2),col=c("blue","yellow","red","green"))
dev.off()
}
______________________________________________
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.
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.
Hi
For this type of problems I do multipage pdf.
pdf("file", ....)
for (i in ...) {
do all stuff including plot
}
dev.off()
and then check the plots afterwards. Recently there was some post about
how to wait but you do not want only wait you want also to interactively
change plotting parameters, won't you.
cat("\n","Enter x","\n") # prompt
x=scan(n=1) # read 1 line from console
this construction print something on console and reads one line from
console. There are also some packages which leave you choose from several
options. I think in car and randomForest are such routines so you could
check how it is done.
Regards
Petr
r-help-bounces at r-project.org napsal dne 14.07.2009 13:17:01:
> hi,
> is there any wait function in R. I am running one R script to plot
> many graphs it is in the for loop. its showing no error but its not
> plotting well I think i can solve this problem with a wait function.
> Please help me in this regards. If u need any clarification about
> programme. u can find the script below.
>
> best regards,
> Deepak.M.R
> Biocomputing Group
> University of Bologana.
>
>
> #!/usr/bin/R
> s<-c
>
("GG","GA","GV","GL","GI","GM","GF","GW","GP","GS","GT","GC","GY","GN","GQ","GD","GE","GK","GR","GH","AA","AV","AL","AI","AM","AF","AW","AP","AS","AT","AC","AY","AN","AQ","AD","AE","AK","AR","AH","VV","VL","VI","VM","VF","VW","VP","VS","VT","VC","VY","VN","VQ","VD","VE","VK","VR","VH","LL","LI","LM","LF","LW","LP","LS","LT","LC","LY","LN","LQ","LD","LE","LK","LR","LH","II","IM","IF","IW","IP","IS","IT","IC","IY","IN","IQ","ID","IE","IK","IR","IH","MM","MF","MW","MP","MS","MT","MC","MY","MN","MQ","MD","ME","MK","MR","MH","FF","FW","FP","FS","FT","FC","FY","FN","FQ","FD","FE","FK","FR","FH","WW","WP","WS","WT","WC","WY","WN","WQ","WD","WE","WK","WR","WH","PP","PS","PT","PC","PY","PN","PQ","PD","PE","PK","PR","PH","SS","ST","SC","SY","SN","SQ","SD","SE","SK","SR","SH","TT","TC","TY","TN","TQ","TD","TE","TK","TR","TH","CC","CY","CN","CQ","CD","CE","CK","CR","CH","YY","YN","YQ","YD","YE","YK","YR","YH","NN","NQ","ND","NE","NK","NR","NH","QQ","QD","QE","QK","QR","QH","DD","DE"!>
,"DK","DR","DH","EE","EK","ER","EH","KK","KR","KH","RR","RH","HH")
> for(t in 1:length(s))
> {
>
a<-read.table(paste("../All_alpha_proteins/alp",s[t],"mean.sat",sep=""),header=T)> attach (a)
> names(a)
>
al<-1:length(paste("alp",s[t],"_mean",sep=""))
>
b<-read.table(paste("../All_beta_proteins/bet",s[t],"mean.sat",sep=""),header=T)> attach(b)
> names(b)
>
bl<-1:length(paste("bet",s[t],"_mean",sep=""))
> p<-read.table(paste("../Alpha_and_beta_proteins_a+b/apb",s
> [t],"mean.sat",sep=""),header=T)
> attach(p)
> names(p)
>
pl<-1:length(paste("apb",s[t],"_mean",sep=""))
> o<-read.table(paste("../Alpha_and_beta_proteins_aorb/aob",s
> [t],"mean.sat",sep=""),header=T)
> attach(o)
> names(o)
>
ol<-1:length(paste("aob",s[t],"_mean",sep=""))
>
postscript(file=paste("Mean_",s[t],"_Plot.ps",sep=""))
> plot(0,xlim=c(0,160),ylim=c(0,70),main=paste("Mean Distance Plot
for
> ",s[t]," Rsidue pair",sep=""),ylab="Mean
Distance in
> Angstrom",xlab="Residue Seperation Number")
>
lines(al,paste("alp",s[t],"_mean",sep=""),col="blue",lty
= 2)
>
lines(bl,paste("bet",s[t],"_mean",sep=""),col="yellow",lty
= 2)
>
lines(pl,paste("apb",s[t],"_mean",sep=""),col="red",lty
= 2)
>
lines(ol,paste("aob",s[t],"_mean",sep=""),col="green",lty
= 2)
> legend("topleft",c("Alpha Proteins","Beta
Proteins","Alpha +
> Beta","Alpha or Beta"),lty >
c(2,2,2,2),col=c("blue","yellow","red","green"))
> dev.off()
> }
>
> ______________________________________________
> 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.