From Martin Maechler <maechler@stat.math.ethz.ch>  Mon Apr  7 08:33:51 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Mon, 7 Apr 97 09:33:51 +0200
Subject: R-alpha: What should is.vector do?
In-Reply-To: <199704062058.IAA09618@stat1.stat.auckland.ac.nz> (message from
 Ross Ihaka on Mon, 7 Apr 1997 08:58:11 +1200 (NZST))
Message-ID: <9704070733.AA00396@>


Ross>> Internally in R, we have a predicate isVector() which returns
Ross>> true if its argument has one of the storage modes "logical",
Ross>> "factor", "ordered", "integer", "real", "complex" and "character".
Ross>> This is useful because these are the types which can be subscripted 
Ross>> (without using CAR and CDR).  We almost certainly need an external
Ross>> version of this predicate.  I suppose that it could be called	 
Ross>> is.vector.mode(x).

Yes, "export"  isVector  as  'is.vector.mode'!

Ross>> Another reasonable definition of "vector" is !is.array(x).
Ross>> or possibly "isVector(x) == 1 && !is.array(x)
Yes, I think
		isVector(x) == 1 && !is.array(x)

is the way to go, at least for   mode = 'any'

Now, for the 2nd argument  mode = '...' :
I think it should always be more restrictive, i.e.,
	  is.vector(OB, mode= MODE)   <-->   is.vector(OB) &&  MODE.test(OB)

which is not the case currently [[correcting a typo in $RHOME/TASKS l.449-451]

 is.vector(call("ls"))			#[1] FALSE
 is.vector(call("ls"), mode='language')	#[1] TRUE
 is.vector(call("ls"), mode='call')	#[1] FALSE

[[here, is.vector(call("ls"), mode='any')  should really return TRUE]]
  
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: What should is.vector do?
Martin Maechler