[R] svyby example returns error

Martin Pozar martin.pozar at gmail.com
Sat Apr 22 14:17:34 CEST 2006


I get error trying to run examples from 'svyby' help page (?svyby in
package "Survey"):

  # code
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
svyby(~api99, ~stype, dclus1, svymean)
  # error message
> Error in match.arg(vartype, several.ok = TRUE) :
        unused argument(s) (several.ok ...)

Is this a version problem? I'm running R Version 2.1.0  (2005-04-18,
i386-pc-linux-gnu) and have installed survey_3.4-4.tar.gz using
install.package("survey", dependencies=T).

I'd be grateful if somebody would trace the problem. I've got as far as
locating this bit of code from 'svyby' function, but can't tell much out
of it, for arguments to 'match.arg' seem ok:
...
 if (missing(vartype))
        vartype <- "se"
    vartype <- match.arg(vartype, several.ok = TRUE)
    nvartype <- pmatch(vartype, eval(formals(sys.function())$vartype))
...

Thanks in advance,
Martin




More information about the R-help mailing list