can i ask your help again, please excuse my questions: It is working perfectly now, i still have the last part which i tried a lot with but still i can’t translate it properly for the computer through R. I need to draw rectangular based on the frequency of each residue, actually i found the pattern, but i am not able to translate it into an automatic R function. First, i drew an empty plot where the rectangles should be placed, then with rect function i drew the rectangles in the preferable pattern but in a manual way, i used this command for this purpose: rect(x*10,y,x+10,y+round(cleaved(x)[k,j]),col=colmap[k]) now i want to translate this pattern to an R function to go through the all data set, specially the y which i suffered with should be cumulative. hear is what i wrote, at the end i put the code which i used, but it is not working properly to translate the pattern that i made manually : hi<-function(x) { height<-rep(0,8) for (j in 1:8){ height[j]<-sum(round(cleaved(x)[,j])) max.height<-max(height) } plot(c(0,10*8),c(0,max.height+20),col="white") } recta<-function(x) { colmap<-c("#FFFFFF", "#FFFFCC", "#FFFF99", "#FFFF66", "#FFFF33", "#FFFF00", "#FFCCFF", "#FFCCCC", "#FFCC99", "#FFCC66", "#FFCC33", "#FFCC00", "#FF99FF", "#FF99CC", "#FF9999", "#FF9966", "#FF9933", "#FF9900", "#FF33FF", "#FF33CC")
rect(1*10,20,10+10,20+round(cleaved(x)[1,1]),col=colmap[1]) rect(1*10,40,10+10,40+round(cleaved(x)[2,1]),col=colmap[2]) rect(1*10,53,10+10,53+round(cleaved(x)[3,1]),col=colmap[3]) rect(1*10,63,10+10,63+round(cleaved(x)[4,1]),col=colmap[4]) rect(1*10,69,10+10,69+round(cleaved(x)[5,1]),col=colmap[5]) rect(1*10,73,10+10,73+round(cleaved(x)[6,1]),col=colmap[6]) rect(1*10,85,10+10,85+round(cleaved(x)[7,1]),col=colmap[7]) rect(1*10,89,10+10,89+round(cleaved(x)[8,1]),col=colmap[8]) rect(1*10,96,10+10,96+round(cleaved(x)[9,1]),col=colmap[9]) rect(1*10,110,10+10,110+round(cleaved(x)[10,1]),col=colmap[10]) rect(1*10,118,10+10,118+round(cleaved(x)[11,1]),col=colmap[11]) rect(1*10,123,10+10,123+round(cleaved(x)[12,1]),col=colmap[12]) rect(1*10,144,10+10,144+round(cleaved(x)[13,1]),col=colmap[13]) rect(1*10,149,10+10,149+round(cleaved(x)[14,1]),col=colmap[14]) rect(1*10,158,10+10,158+round(cleaved(x)[15,1]),col=colmap[15]) rect(1*10,170,10+10,170+round(cleaved(x)[16,1]),col=colmap[16]) rect(1*10,198,10+10,198+round(cleaved(x)[17,1]),col=colmap[17]) rect(1*10,213,10+10,213+round(cleaved(x)[18,1]),col=colmap[18]) rect(1*10,225,10+10,225+round(cleaved(x)[19,1]),col=colmap[19]) rect(1*10,229,10+10,225+round(cleaved(x)[20,1]),col=colmap[20]) } recta<-function(x) { colmap<-c("#FFFFFF", "#FFFFCC", "#FFFF99", "#FFFF66", "#FFFF33", "#FFFF00", "#FFCCFF", "#FFCCCC", "#FFCC99", "#FFCC66", "#FFCC33", "#FFCC00", "#FF99FF", "#FF99CC", "#FF9999", "#FF9966", "#FF9933", "#FF9900", "#FF33FF", "#FF33CC") for (j in 1:8){ xx<-j*10 for(k in 1:20){ yy<-cumsum(round(cleaved(x)[k,j])) rect(xx,yy,xx+10,yy+round(cleaved(x)[k,j]),col=colmap[k]) } } } -- View this message in context: http://n4.nabble.com/More-than-on-loop-tp1015851p1289636.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.