[Rd] `as.vector' documentation

François Pinard pinard at iro.umontreal.ca
Wed Apr 19 20:43:27 CEST 2006


Hi, people.  This is R 2.2.1 under i686 Linux:


> attributes(as.vector(data.frame(a=1)))
$names
[1] "a"

$row.names
[1] "1"

$class
[1] "data.frame"


?attribute says:

     'as.vector', a generic, attempts to coerce its argument into a
     vector of mode 'mode' (the default is to coerce to whichever mode
     is most convenient).  The attributes of 'x' are removed.


The last sentence could be amended to say that the attributes of 'x' are 
removed "if the coercion succeeds".  As currently written, it may be 
interpreted as meaning that the attributes are removed unconditionally.


-- 
François Pinard   http://pinard.progiciels-bpi.ca



More information about the R-devel mailing list