Re: [R] More than on loop??

2010-02-02 Thread che
hey Jim. brilliant, very short and productive, wish that i can have such skill in the future, i will try to learn about all functions that you used. thanks very much for helping me, i really appreciate it. -- View this message in context: http://n4.nabble.com/More-than-on-loop-tp1015851p1460459

Re: [R] More than on loop??

2010-01-31 Thread che
hello, i appreciate your help, your help, comments, and suggestion really are so helpful to develop not only my R skills, but also my programming language sense. as i said, i am not breaking any academic rules, and this is a softwar i have to develop to deal with my project after two months along

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
Also this looks like homework, so I can not really reply with a solution. BTW, once you have the normalized matrix, barplot will create your output without the complications of steps 8-13. You will have to use the data to put the text, but that again is relatively easy with the data. On Sat, Jan

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
One quick comment about looking at the graphs you provided, why aren't all 8 columns the same height given that each column should have the same number of amino acids in them. FOr the cleaved case is it 114 and even after normalizing, the column sums should be the same -- 100. Are the graphs real

Re: [R] More than on loop??

2010-01-30 Thread che
Here is the the written instruction as i managed to get it from my professor, the graphs and data are attached: The graph below shows an example of the expected outcome of this course work. You may procude a better one. The graph for analysing the motifs of a set of peptides is designed this way

Re: [R] More than on loop??

2010-01-30 Thread jim holtman
It is not entirely clear what you are trying to do. Can you explain what the matrix that you are creating out of 'cleaved' represents? "Tell me what you want to do; not how you want to do it". It is hard to follow code when you have not explained what it is doing. THere appear to be all kinds o

Re: [R] More than on loop??

2010-01-27 Thread che
yes, but the outcome graphs are almost the same, that mean it does not calculated in a cumulative way , if you apply the following code, then run hi(x), and then recta(x), you will see how the shape are similar to the frequency of Amino Acid in the matrix. i am looking for a code that can do thi

Re: [R] More than on loop??

2010-01-25 Thread jim holtman
It sounds like you want to use 'barplot' like below given that it appears that the value in x.c would be the matrix you want to graph: x.c <- cleaved(x) barplot(x.c, col=c("#FF", "#CC", "#99", "#66", "#33", "#00", "#FFCCFF", "#FF", "#FFCC99", "#FFCC66", "#FFCC33",

Re: [R] More than on loop??

2010-01-25 Thread che
70% yes, the problem is i am trying to produce a graph similar to the one in attachments in this message, which represents the frequency of each letter "aminoacid" in the cleaved function and the noncleaved function. some thing else i added to the attachments is the pattern which seemingly working

Re: [R] More than on loop??

2010-01-25 Thread jim holtman
Does this do what you want? You were not initializing the plot before calling 'rect'. also it appears that you only have to call cleaved(x) once to get the matrix and then use it in the loop -- more efficient that way. x<-read.table("C:/hiv.txt", header=TRUE) num<-nrow(x) AA<-c('A','C','D','E','

Re: [R] More than on loop??

2010-01-25 Thread che
hopefully it is here, two files, one of them is .dat and the others is .txt, just in case. http://n4.nabble.com/file/n1290026/hiv.dat hiv.dat http://n4.nabble.com/file/n1290026/hiv.txt hiv.txt -- View this message in context: http://n4.nabble.com/More-than-on-loop-tp1015851p1290026.html Sent f

Re: [R] More than on loop??

2010-01-25 Thread che
here you are the whole code, and the data is attached: > x<-read.table("C:/Uni/502/CA2/hiv.dat", header=TRUE) > num<-nrow(x) > AA<-c('A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y') > nc<-x$Label[61:308] > c<-x$Label[nc] > noncleaved<-function(x) + { + y<-matrix(0,2

Re: [R] More than on loop??

2010-01-25 Thread che
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 patter

Re: [R] More than on loop??

2010-01-24 Thread jim holtman
Notice that 'nc' is multivalued (nc<-x$Label[61:308]). If you want to check if x$Label[i] is one of the values in 'nc', then use %in%: if (x$Label[i] %in% nc) The error happens because 'if' can only have a single conditional expressions and your original 'if' statement would have resulted i

Re: [R] More than on loop??

2010-01-24 Thread che
Really thanks very much, with your help i was able to write a prober code to count the aminoacids in all the cleaved and noncleaved and then to display the results in a matrix with 8 column, i used only two loops instead of three. The code is working but i still have warning telling me that: “In

Re: [R] More than on loop??

2010-01-16 Thread jim holtman
I found the data you sent with the help of David Winsemius. Are you just trying to count the number of amino acids in each of the groups? Is it something like this: > # split by the Label > x <- split(amino, amino$Label) > # now count the number of aminos in each group > lapply(x, function(.lab)

Re: [R] More than on loop??

2010-01-16 Thread jim holtman
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 wrote: > > Thank you very much for your help, > > you have been ex

Re: [R] More than on loop??

2010-01-16 Thread che
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

Re: [R] More than on loop??

2010-01-16 Thread David Winsemius
On Jan 16, 2010, at 7:09 PM, che wrote: hello every one, How to function more than one loop in R? for (i in 1:3) { for (j in 1:2) { for (k in letters[1:4]) { print(paste(i , j, k) ) } } } I'm afraid I develop a strong suspicion that a problem is homewor

[R] More than on loop??

2010-01-16 Thread che
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 “no