[英]Getting arguments of heplot function from heplots R package
Getting arguments of an R
function is quite easy and can be extracted by args(functionname)
.获取
R
函数的参数非常简单,可以通过args(functionname)
提取。 But I could not figured out how to get the arguments of heplot
function from heplots
package.但是我不知道如何从
heplots
包中获取heplot
函数的参数。
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. heplot
是一个 S3 通用函数。 It uses a method, heplot.mlm
, which is a non-exported function.它使用一种方法
heplot.mlm
,这是一个非导出函数。 You can access that information by first looking at the function body of heplot
.您可以通过首先查看
heplot
的函数体来访问该信息。 If you see UseMethod
in a function body, the function uses a method.如果您在函数体中看到
UseMethod
,则该函数使用了一个方法。 All the available methods for S3 generic functions can be accessed with methods
S3 泛型函数的所有可用方法都可以通过
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
包装该调用,您将获得所需的参数列表。
> 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.可能是浏览参数列表的更好、更易读的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.