[R] Odp: hi friends, is there any wait function in R

Petr PIKAL petr.pikal at precheza.cz
Tue Jul 14 13:48:25 CEST 2009


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.




More information about the R-help mailing list