Re: [R] "which" command

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Thu 05 Oct 2006 - 22:34:49 GMT

On Thu, 2006-10-05 at 16:57 -0400, AgusSusanto wrote:
> I obtained error messages when I run these commands in UNIX, but I
> obtained correct result when I run these command in WINDOWS. Can
> somebody point out the problem and give the solution. Thanks.

Not without Fall.dat I suspect. please read the posting guide and act accordingly. (And why post twice?)

I suspect some of your data are missing in Fall.dat (or end up missing because you didn't check what had been read in by R) and that this has propagated warnings in say mean, when called within na.rm = TRUE. But I'm guessing as you fail to provide a reproducible example.

Why this is different between Unix/windows versions of R, I don't know, but are they running the same versions of R?

G

>
> > dt<-read.table(file="Fall.dat")
> > dim(dt)
> [1] 1941 5
> > table(dt$V2)
> 0 1 2 3
> 220 989 639 93
> >
> > Favg<-as.matrix(c(1:max(dt$V2)))
> >
> > for(i in 1:max(dt$V2)){Favg[i]<-mean(dt[which(dt[,2] == i),5])}
> > Favg
> [,1]
> [1,] NA
> [2,] NA
> [3,] NA
> Warning messages:
> argument is not numeric or logical: returning NA (etc)
>
>
> Cheers,
> @
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [t] +44 (0)20 7679 0522
ECRC                              [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building                  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK                        [w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT                          [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Fri Oct 06 08:39:46 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 05 Oct 2006 - 23:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.