Hi, 

This IS the code of the function. It is a generic function, the actual method 
used depends on the class of the object. 
You will find methods for this function by doing: 

R> methods("svymean")
[1] svymean.survey.design*  svymean.survey.design2* svymean.svyrep.design* 
[4] svymean.twophase*      

   Non-visible functions are asterisked

And then, since they are trapped into the survey namespace, you can use either 
getAnywhere or ::: as in :

R> getAnywhere("svymean.twophase")
A single object matching ‘svymean.twophase’ was found
It was found in the following places
  registered S3 method for svymean from namespace survey
  namespace:survey
with value

function (x, design, na.rm = FALSE, deff = FALSE, ...) 
{
    if (inherits(x, "formula")) {
        mf <- model.frame(x, design$phase1$sample$variables, 
            na.action = na.pass)
        xx <- lapply(attr(terms(x), "variables")[-1], function(tt) 
model.matrix(eval(bquote(~0 + 
            .(tt))), mf))
...

R> survey:::svymean.twophase
function (x, design, na.rm = FALSE, deff = FALSE, ...) 
{
    if (inherits(x, "formula")) {
        mf <- model.frame(x, design$phase1$sample$variables, 
            na.action = na.pass)
        xx <- lapply(attr(terms(x), "variables")[-1], function(tt) 
model.matrix(eval(bquote(~0 + 
            .(tt))), mf))
        cols <- sapply(xx, NCOL)
        x <- matrix(nrow = NROW(xx[[1]]), ncol = sum(cols))
        scols <- c(0, cumsum(cols))
...

Cheers, 

Romain

--
Mango Solutions
data analysis that delivers
Tel: +44(0) 1249 467 467
Mob: +44(0) 1249 467 468
Fax: +44(0) 7813 526 123



-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Luis Ridao Cruz
Sent: Fri 25/01/2008 14:46
To: [EMAIL PROTECTED]
Subject: [R] function code
 
R-help,

Sorry for this question (I guess it has been addressed before but 
I could not find it in the archives)
but how can I see a function code
when the following comes up:

> svymean
function (x, design, na.rm = FALSE, ...) 
{
    .svycheck(design)
    UseMethod("svymean", design)
}
<environment: namespace:survey>


Thanks in advance

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to