
Use `methods` para encontrar os métodos da função desejada:
methods(Function) [1] Function.areg.boot Function.transcan see '?methods' for accessing help and source code
Esta função tem dois métodos associados a ela: Function.areg.boot e Function.transcan. Agora é só pedir pra ver o código fonte do método que te interessa:
Function.areg.boot function (object, type = c("list", "individual"), ytype = c("transformed", "inverse"), prefix = ".", suffix = "", pos = -1, ...) { type <- match.arg(type) ytype <- match.arg(ytype) if (missing(type) && !(missing(prefix) & missing(suffix) & missing(pos))) type <- "individual" fit <- object$fit k <- length(fit) nam <- names(fit) g <- vector("list", k) xtype <- object$xtype typey <- object$ytype catl <- object$cat.levels names(g) <- nam for (i in 1:k) { typ <- if (i == 1) typey else xtype[i - 1] if (typ == "c") { if (i == 1 && ytype == "inverse") stop("currently does not handle ytype=\\"inverse\\" when y is categorical") h <- function(x, trantab) { if (is.factor(x)) x <- as.character(x) trantab[x] } w <- fit[[i]]$y names(w) <- catl[[nam[i]]] formals(h) <- list(x = numeric(0), trantab = w) } else { h <- function(x, trantab) { s <- !is.na(x) res <- rep(NA, length(x)) res[s] <- approxExtrap(trantab, xout = x[s])$y res } fiti <- fit[[i]] formals(h) <- list(x = numeric(0), trantab = if (i == 1 && ytype == "transformed") list(x = fiti[[2]], y = fiti[[1]]) else fiti) } g[[i]] <- h } if (type == "list") return(g) fun.name <- paste(prefix, nam, suffix, sep = "") for (i in 1:k) assign(fun.name[i], g[[i]], pos = pos) invisible(fun.name) } <environment: namespace:Hmisc>
-- Marcus Nunes Professor Adjunto Universidade Federal do Rio Grande do Norte Centro de Ciências Exatas e da Terra Departamento de Estatística Laboratório de Estatística Aplicada marcus.nunes@ccet.ufrn.br http://marcusnunes.me/ 2017-08-25 13:21 GMT-03:00 Pedro Emmanuel Alvarenga Americano do Brasil via R-br <r-br@listas.c3sl.ufpr.br>:
Amigos de R,
Gostaria de poder ver a sequencia de operações que uma função faz. Na maioria das funções, basta digitar o nome da função no console, por exemplo
trimws function (x, which = c("both", "left", "right")) { which <- match.arg(which) mysub <- function(re, x) sub(re, "", x, perl = TRUE) if (which == "left") return(mysub("^[ \t\r\n]+", x)) if (which == "right") return(mysub("[ \t\r\n]+$", x)) mysub("[ \t\r\n]+$", mysub("^[ \t\r\n]+", x)) } <bytecode: 0x0000000002fdbd78> <environment: namespace:base>
No entanto, algumas funções não seguem essa regra e eu não sei como fazer. Por exemplo
library(Hmisc)
Function function (object, ...) UseMethod("Function") <environment: namespace:Hmisc>
Alguma dica pra conseguir enxergar as operações dessa função?
Abraço forte,
Pedro Brasil
_______________________________________________ R-br mailing list R-br@listas.c3sl.ufpr.br https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.