В Mon, 24 Oct 2022 12:07:44 -0400
Kelly Thompson <kt1572...@gmail.com> пишет:

> require( packages_i_want_to_use[1] )
> #Error in if (!loaded) { : the condition has length > 1

This seems to be a bug in require(). In addition to understanding
character strings as arguments, require() can load packages named by
unquoted barewords:

require(base)

This uses non-standard evaluation, and the part that transforms an
unquoted symbol into a package name doesn't expect to see what is
effectively `[`(packages_i_want_to_use, 1) instead of a single symbol.

If you pass the character.only = TRUE argument to require(), this
additional handling is disabled, making your examples work again. It's
a good idea to always pass this argument when calling require() with a
variable as the first argument.

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to