Skip to content

exists() and the mode argument (PR#576)

2 messages · Jonathan Rougier, Brian Ripley

#
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
the same category, I have just noticed that

get("fred") # 1:10
get("fred", mode="numeric") # gives an Error: variable "fred" was not found

Cheers, Jonathan.

--please do not edit the information below--

Version:
 platform = sparc-sun-solaris2.7
 arch = sparc
 os = solaris2.7
 system = sparc, solaris2.7
 status = 
 major = 1
 minor = 0.1
 year = 2000
 month = April
 day = 14
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 20 Jun 2000 J.C.Rougier@durham.ac.uk wrote:

            
Its `mode' is
[1] "integer"

and so
[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
[1] T
[1] T
[1] T

(sic)