> methods(length)
[1] length.pdf_doc* length.POSIXlt
see '?methods' for accessing help and source code
> length.POSIXlt
function (x)
length(x[[1L]])
<bytecode: 0x00000000111d75b0>
<environment: namespace:base>
-------------------------------------------------------------------------
方法一:直接写函数名称,如在R中查看回归分析代码:
- lm
复制代码
直接可以查看到
- function (formula, data, subset, weights, na.action, method = "qr",
- model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
- contrasts = NULL, offset, ...)
- {
- ret.x <- x
- ret.y <- y
- cl <- match.call()
- mf <- match.call(expand.dots = FALSE)
- m <- match(c("formula", "data", "subset", "weights", "na.action",
- "offset"), names(mf), 0L)
- mf <- mf[c(1L, m)]
- mf$drop.unused.levels <- TRUE
- mf[[1L]] <- quote(stats::model.frame)
- mf <- eval(mf, parent.frame())
- if (method == "model.frame")
- return(mf)
- else if (method != "qr")
- warning(gettextf("method = '%s' is not supported. Using 'qr'",
- method), domain = NA)
- mt <- attr(mf, "terms")
- y <- model.response(mf, "numeric")
- w <- as.vector(model.weights(mf))
- if (!is.null(w) && !is.numeric(w))