[R] trouble with data frame

2013-03-22 Thread Sahana Srinivasan
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

Re: [R] trouble with data frame

2013-03-22 Thread Jorge I Velez
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

Re: [R] trouble with data frame

2013-03-22 Thread Berend Hasselman
On 22-03-2013, at 12:34, Sahana Srinivasan sahanasrinivasan...@gmail.com 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)

Re: [R] trouble with data frame

2013-03-22 Thread Marc Girondot
Le 22/03/13 12:34, Sahana Srinivasan a écrit : 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. Perhaps with