J.C.Rougier@durham.ac.uk
2000-Jun-20 11:03 UTC
[Rd] exists() and the mode argument (PR#576)
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:> 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". InIts `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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._