Sahana, The notation
df[a,b)] is plain wrong. I think you meant (but I may be mistaken) df[a, b] and I am not still sure if that would work in your example. Have you instead considered subset()? E.g., subset(df, a <= 10 & b <= 10) See ?subset for more details. Also, "df" is a very bad name for your data.frame. Check ?df to know why. HTH, Jorge.- On Fri, Mar 22, 2013 at 10:34 PM, Sahana Srinivasan <> wrote: > Hi everyone, > I am trying to use the values from every cell of the data frame in a > further calculation. > This is the code that I am using to catch every element of the data-frame. > > while (a<=10) > { > while (b<=10) > { > n<-as.numeric(df[a,b)]; > ...; > } > } > > The problem is that when I print out 'n' I get the following errors : > "NULL" (if printed without as.numeric), and "numeric(0)" if printed with > the as.numeric. > > Again, if I use the same command without the loop, it gives the correct > answer. > > Would be grateful for your inputs and ideas on this matter. Thanks in > advance, > Sahana. > > [[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. > [[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.