[R] Suming logical vectors

Murray Jorgensen maj at stats.waikato.ac.nz
Thu Sep 18 04:05:01 CEST 2003


Blush!  Not too hard to explain at all!

Deepayan Sarkar wrote:

> Your IATmedian has some NAs (which are removed by sort) ?
> 
> On Thu, 18 Sep 2003, Murray Jorgensen wrote:
> 
> 
>>Can anyone explain the following?  [R 1.6.0 Windows XP, yes I will
>>upgrade soon.]
>>
>>Murray
>>
>> > sort(IATmedian)[0:50]==0
>>  [1]  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>>FALSE
>>[13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>>[25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>>[37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>>[49] FALSE FALSE
>> > sum(sort(IATmedian)[0:50]==0)
>>[1] 2
>> > sum(sort(IATmedian)==0)
>>[1] 2
>> > sum(IATmedian==0)
>>[1] NA
>>
>>--
>>Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
>>Department of Statistics, University of Waikato, Hamilton, New Zealand
>>Email: maj at waikato.ac.nz                                Fax 7 838 4155
>>Phone  +64 7 838 4773 wk    +64 7 849 6486 home    Mobile 021 1395 862
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
> 
> 
> 

-- 
Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz                                Fax 7 838 4155
Phone  +64 7 838 4773 wk    +64 7 849 6486 home    Mobile 021 1395 862




More information about the R-help mailing list