[Rd] Problem with "missing" in "local" (PR#1241)

J.C.Rougier@durham.ac.uk J.C.Rougier@durham.ac.uk
Fri, 4 Jan 2002 14:41:57 +0100 (MET)


Hi everyone,

I encountered unexpected behaviour when calling "missing" within a
"local" environment, namely

fred <- function(x, y)
{
  x <- as.vector(x)
  local({
    dontwantme <- 1:100
    if (missing(y)) print("No \"y\" today")
  })
  x
}

whereupon I get

> fred(1:10)
Error in eval(expr, envir, enclos) : "missing" illegal use of missing

I think it is reasonable to expect missing to work in this context (I
suspect the problem relates to lazy evaluation): if not, it might be
helpful to amend the help file.

Cheers, Jonathan.

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 4.0
 year = 2001
 month = 12
 day = 19
 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._