A fix that for 'bquote' that may work (PR#14031)
On Thu, 5 Nov 2009, suharto_anggono at yahoo.com wrote:
This is a fix for 'bquote' that may work.
function (expr, where =3D parent.frame())=20
{
unquote <- function(e) {
if (length(e) <=3D 1 || !is.language(e))=20
e
else if (e[[1]] =3D=3D as.name("."))=20
eval(e[[2]], where)
else as.call(lapply(e, unquote))
}
unquote(substitute(expr))
}
If you want to use bquote() on function definitions a better fix is
bquote <- function (expr, where = parent.frame())
{
unquote <- function(e) {
if (length(e) <= 1)
e
else if (e[[1]] == as.name("."))
eval(e[[2]], where)
else if (is.pairlist(e)){
as.pairlist(lapply(e,unquote))
}
else as.call(lapply(e, unquote))
}
unquote(substitute(expr))
}
since that now allows substitution into default arguments, eg
default<-1
g<-b2quote(function(x,y=.(default)) x+y )
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle