[R] trouble with data frame
Berend Hasselman
bhh at xs4all.nl
Fri Mar 22 12:45:59 CET 2013
On 22-03-2013, at 12:34, Sahana Srinivasan <sahanasrinivasan.91 at 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)
> {
> n<-as.numeric(df[a,b)];
The )] should be ]).
> ...;
> }
> }
>
> 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,
Data?
Reproducible example?
Without the contents of your dataframe no sensible answer can be given.
E.g. use dput(head(df))
Berend
> Sahana.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list