On 25-03-2013, at 18:43, Sahana Srinivasan <sahanasrinivasan...@gmail.com> wrote:
> Hi everyone, > I'm using the following code to go over every element of a data frame (row > wise). The problem I am facing is that the outer 'x' variable is not > incrementing itself, thus, only one row of values is obtained, and the > program does not proceed to the next row. > > This is the code: > while(x<=coln) > { > > while(y<=rown) > { > n<-as.numeric(df[[y]][x]); > if(n>0) > { > lim<-(n-1); > S<-100; > (...) > } > opdf[[y]][x]<-sum; > } > y<-y+1; > } > x<-x+1; > } > > Here is a sample of the input data: > > > GENE A CD EF GH IK LM NP QR ST VW Y 2amt:Amet_0001 29 023 3417 1612 4229 39635 > 20 1325 3427 323 12 3amt:Amet_0002 19 315 4212 188 3525 437 2613 914 2120 30 > 0 8 This does not provide reproducible code or an example. You should also count the opening { and the closing }. Berend ______________________________________________ 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.