Since there was no data, it is hard to propose a solution. I would estimate that 'loops' are not required; the use of 'table' or one of the 'apply' functions will probably provide the answer.
On Sat, Jan 16, 2010 at 8:04 PM, che <fadialn...@live.com> wrote: > > Thank you very much for your help, > > you have been excused to have a suspicion, but dont worry i am not > cheating, it is not a home work, rather it is a pre-project task that i > have > to deal with in order to prepare to my project, and i cant understand this > programming things alone, i tried my best but still i cant deal with it > properly, i am studying master and PhD in bioinformatics, and i need to > develop a good understanding of programming languages. still a beginner > but > i start to have some fears ... what ever you send me, i study it and know > exactly how it works, and believe me that can help a lot to develop my > skills. Moreover i am dealing with it in a very honesty way that does not > break any academic regulations. > > thanks again i will try what you sent me .. > > Yours > > che wrote: > > > > hello every one, > > > > How to function more than one loop in R? I have the following problem to > > be solved with the a method of three loops, can you help me please? > > > > The data is attached with this message. > > > > The data is composed of two parts, cleaved (denoted by cleaved) and non > > cleaved (denoted by noncleaved). > > to access to the ith peptide, you can use X$Peptide[i] > > to access to the ith label, you can use X$Label[i] > > > > define a set of amino acids using string or other format if you want > > amino.acid<-"ACDEFGHIKLMNPQRSTVWY" > > define two matrices with initialised entries, one for cleaved peptides > > and one for none-cleaved peptides > > matrix(0,AA,mer),where AA is the number of amino acids, and mer is the > > number > > of residues detected from data using the nchar function > > both matrices have the same size, the number of rows being equal to the > > number > > of amino acids and the number of columns being equal to the number of > > residues > > in peptides > > > > > > use one three-loop structure to detect the frequency of amino acids in > > cleaved peptides > > and one three-loop structure to detect the frequency of amino acids in > > non-cleaved > > peptides. They should not be mixed in one three-loop structure. The best > > way to > > handle this is to use a function. The three-loop structure is exampled as > > below > > for(i in 1:num)#scanning data for all peptides, where num means the > number > > of peptides > > { > > for(j in 1:mer)#scanning all residues in a peptide > > { > > for(k in 1:AA)#scanning 20 amino acids > > { > > #actions > > } > > } > > } > > http://n4.nabble.com/file/n1015851/hiv.dat hiv.dat > > > > -- > View this message in context: > http://n4.nabble.com/More-than-on-loop-tp1015851p1015863.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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
______________________________________________ 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.