An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130322/c42e629b/attachment.pl>
trouble with data frame
4 messages · Sahana Srinivasan, Jorge I Velez, Berend Hasselman +1 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130322/4187c7ff/attachment.pl>
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.
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 n<-as.numeric(df[a,b]) )] are reversed Marc
__________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot