"KH" == Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
on Fri, 17 Oct 2003 09:04:40 +0200 writes:
David James <dj@research.bell-labs.com> writes:
Calls of the form data(package = pkg) inside a function
incorrectly fail ("pkg" is a local variable). For instance,
foo <- function(pkg) data(package = pkg)
foo("base")
Error in .find.package(package, lib.loc, verbose = verbose) :
none of the packages were found
This is pretty much unavoidable if you want a function to accept
unquoted names. It's not in principle different from
women <- "airquality"
data(women)
not being equivalent to data("airquality"). Some functions (library(),
require(), demo()) have a character.only argument to prevent it, and I
suppose we should consider putting it on help() and data() as well.