Pass the name of the character package to help the function

It works:

help(package="ggplot2") 

It does not mean:

 x <-"ggplot2" help(package=x) # Error in find.package(pkgName, lib.loc, verbose = verbose) : # there is no package called 'x' 

How can I do this to pass x to open the help page?

+6
source share
2 answers

Put the variable in parentheses:

 x <-"ggplot2" help(package=(x)) 

The help file for ?help Help pretty smooths the states for the package argument:

To avoid using a dewaxed name, for example. (pkg_ref) (see examples).

+6
source

Help and library iterations to interpret character class input can be built using do.call

  x <-"ggplot2" do.call(library, list(x)) do.call(help, list(package=x)) 
+4
source

Source: https://habr.com/ru/post/915992/


All Articles