Getting arguments of an R
function is quite easy and can be extracted by args(functionname)
. But I could not figured out how to get the arguments of heplot
function from heplots
package.
library(heplots)
?heplot
args(heplot)
function (mod, ...)
NULL
I want to get the following part:
## S3 method for class 'mlm'
heplot(mod, terms, hypotheses, term.labels = TRUE,
hyp.labels = TRUE, err.label="Error", label.pos=NULL,
variables = 1:2, error.ellipse = !add,
factor.means = !add, grand.mean = !add, remove.intercept = TRUE,
type = c("II", "III", "2", "3"), idata=NULL, idesign=NULL,
icontrasts=c("contr.sum", "contr.poly"),
imatrix=NULL, iterm=NULL, markH0=!is.null(iterm),
manova, size = c("evidence", "effect.size"),
level = 0.68, alpha = 0.05, segments = 40,
center.pch = "+", center.cex=2,
col = getOption("heplot.colors",
c("red", "blue", "black", "darkgreen",
"darkcyan","magenta", "brown","darkgray")),
lty = 2:1, lwd = 1:2,
fill=FALSE, fill.alpha=0.3,
xlab, ylab, main = "", xlim, ylim, axes=TRUE, offset.axes,
add = FALSE, verbose = FALSE, warn.rank = FALSE, ...)
heplot
is an S3 generic function. It uses a method, heplot.mlm
, which is a non-exported function. You can access that information by first looking at the function body of heplot
. If you see UseMethod
in a function body, the function uses a method. All the available methods for S3 generic functions can be accessed with methods
> methods(heplot)
To access a non-exported function, you can use :::
. Wrap that call with args
and you have the argument list you're looking for.
> args(heplots:::heplot.mlm)
# function (mod, terms, hypotheses, term.labels = TRUE, hyp.labels = TRUE,
# err.label = "Error", label.pos = NULL, variables = 1:2, error.ellipse = !add,
# factor.means = !add, grand.mean = !add, remove.intercept = TRUE,
# type = c("II", "III", "2", "3"), idata = NULL, idesign = NULL,
# icontrasts = c("contr.sum", "contr.poly"), imatrix = NULL,
# iterm = NULL, markH0 = !is.null(iterm), manova, size = c("evidence",
# "effect.size"), level = 0.68, alpha = 0.05, segments = 40,
# center.pch = "+", center.cex = 2, col = getOption("heplot.colors",
# c("red", "blue", "black", "darkgreen", "darkcyan", "magenta",
# "brown", "darkgray")), lty = 2:1, lwd = 1:2, fill = FALSE,
# fill.alpha = 0.3, xlab, ylab, main = "", xlim, ylim, axes = TRUE,
# offset.axes, add = FALSE, verbose = FALSE, warn.rank = FALSE,
# ...)
# NULL
Note: This function obviously has a lot of arguments, so
> formals(args(heplots:::heplot.mlm)) ## or as.list()
might be a nicer, more readable way to go through the argument list.