直接打该函数不就得了?一些函数比方说以下例子就例外:
> mean
standardGeneric for "mean" defined from package "base"
function (x, ...)
standardGeneric("mean")
<environment: 0x0000000009a7ad10>
Methods may be defined for arguments: x
Use showMethods("mean") for currently available ones.
> mean.default
function (x, trim = 0, na.rm = FALSE, ...)
{
if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) {
warning("argument is not numeric or logical: returning NA")
return(NA_real_)
}
if (na.rm)
x <- x[!is.na(x)]
if (!is.numeric(trim) || length(trim) != 1L)
stop("'trim' must be numeric of length one")
n <- length(x)
if (trim > 0 && n) {
if (is.complex(x))
stop("trimmed means are not defined for complex data")
if (anyNA(x))
return(NA_real_)
if (trim >= 0.5)
return(stats::median(x, na.rm = FALSE))
lo <- floor(n * trim) + 1
hi <- n + 1 - lo
x <- sort.int(x, partial = unique(c(lo, hi)))[lo:hi]
}
.Internal(mean(x))
}
<bytecode: 0x000000001defd6b0>
<environment: namespace:base>
如果有github的话,可以到该作者的repo逐个逐个瞧... 因为有许多高手都是喜欢编写小函数,然后互相调用看起来比较简洁...