[R] "which" command

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Oct 6 00:34:49 CEST 2006


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 at 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/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list