[R] Suming logical vectors

Murray Jorgensen maj at stats.waikato.ac.nz
Thu Sep 18 02:55:03 CEST 2003


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




More information about the R-help mailing list