[Rd] exists() and the mode argument (PR#576)

Prof Brian D Ripley ripley@stats.ox.ac.uk
Tue, 20 Jun 2000 13:19:11 +0100 (BST)


On Tue, 20 Jun 2000 J.C.Rougier@durham.ac.uk wrote:

> The following seems to be odd behaviour:
> 
> fred <- 1:10
> mode(fred) # "numeric"
> exists("fred") # TRUE
> exists("fred", mode="numeric") # FALSE
> 
> Unless I have misunderstood, the final evaluation should be TRUE,
> as an object called "fred" exists and its mode is "numeric".  In

Its `mode' is 
> typeof(fred)
[1] "integer"

and so

> exists("fred", mode="integer")
[1] TRUE

See ?exists

    mode: the type of interest for the object.
              ^^^^ 

I think this needs to be re-written in the documentation, or do
people think it should be the value of mode?  The latter appears
to be what the prototype uses, in that

> exists("fred", mode="numeric")
[1] T
> exists("fred", mode="integer")
[1] T
> exists("fred", mode="double")
[1] T

(sic)


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._