hi all how can i see the code inside a particular function? i know one can simply type the function, eg ls, but sometimes when this is done one will get "UseMethod("some function name"). (One could also use "body" but i have the same problem in this case. )How does one see the code in this case?
Sometimes it's in <function_name>.default Eg:> barplotfunction (height, ...) UseMethod("barplot") <environment: namespace:graphics>> barplot.defaultfunction (height, width = 1, space = NULL, names.arg = NULL, legend.text = NULL, beside = FALSE, horiz = FALSE, density = NULL, angle = 45, col = NULL, border = par("fg"), main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, xpd = TRUE, axes = TRUE, axisnames = TRUE, cex.axis = par("cex.axis"), cex.names = par("cex.axis"), inside = TRUE, plot = TRUE, axis.lty = 0, offset = 0, ...) { if (!missing(inside)) .NotYetUsed("inside", error = FALSE) if (missing(space)) space <- if (is.matrix(height) && beside) c(0, 1) etc etc Mick -----Original Message----- From: r-help-bounces at stat.math.ethz.ch on behalf of Clark Allan Sent: Mon 12/13/2004 4:14 PM To: r-help at stat.math.ethz.ch Cc: Subject: [R] R: functions problem hi all how can i see the code inside a particular function? i know one can simply type the function, eg ls, but sometimes when this is done one will get "UseMethod("some function name"). (One could also use "body" but i have the same problem in this case. )How does one see the code in this case?
Two issues are at play here, S3 methods and namespaces. You need to read up on both. But, in brief, to get an ** exported ** S3 method you need to type: method.class, e.g.>summary.lmIf the method is ** not** exported, you need the ::: operator or look at ?getAnywhere . -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Clark Allan > Sent: Monday, December 13, 2004 8:15 AM > To: r-help at stat.math.ethz.ch > Subject: [R] R: functions problem > > hi all > > > how can i see the code inside a particular function? i know one can > simply type the function, eg ls, but sometimes when this is done one > will get "UseMethod("some function name"). (One could also use "body" > but i have the same problem in this case. )How does one see > the code in > this case? >