R-alpha: [logical, drop = FALSE] -- my silliness ..

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Thu, 21 Aug 1997 09:40:08 +0200


I must have been a bit tired or screwed up otherwise:
As Thomas guessed, I've forgotten the extra ","  which is needed for drop=..

ma[logi, , drop = FALSE]	works all right.
        ^^^
	do not forget this !

 MM> Look at this :
 MM> 
 MM> ma <- cbind(1,1:8); logi <- rep(c(T,F),4)
 MM> ma[logi,]
 MM> ##>      [,1] [,2]
 MM> ##> [1,]    1    1
 MM> ##> [2,]    1    3
 MM> ##> [3,]    1    5
 MM> ##> [4,]    1    7
 MM> 
 MM> ##-- now the same with  [ , drop = FALSE]
 MM> 
 MM> ## R (-0.50-a3) :
 MM> 
 MM> 	 ma[logi, drop = F]
 MM> ##>> Error: invalid subscript type
 MM> ## Splus-3.4:
 MM> 	 ma[logi, drop = F]
 MM> ##>> [1] 1 1 1 1 1 3 5 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-