On Dec 18, 2010, at 8:11 PM, Joel Schwartz wrote:
and does anyone know if it is possible to find the codes for
functions in survey package?
Yes, you can find the code by doing the following:
1) Go to the CRAN R package list (http://cran.r-project.org/web/packages/
),
scroll down to the "survey" package link and click on it.
2) Scroll down to the "Downloads" section and download the "package
source"
file. The "R" folder in this file contains the code for the
functions in the
package.
You can of course follow an analogous procedure to get the code for
other
packages.
There might be an easier or quicker way to do it from within R
but ,if there
is, I haven't learned it yet.
(I suspect Joel knows this.)
If the package is loaded, you can just type the name of the function
at the console.
svyhist # produces about a half-page of code.
Joel
-----Original Message-----
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of andrija djurovic
Sent: Saturday, December 18, 2010 4:23 PM
To: r-help@r-project.org
Subject: [R] package survey
Hi R users,
could someone help me to find out which formulas, for
standard error calculation, are used in following example:
a=data.frame(weights=rep(c(10,1),c(4,1)),fpc=rep(41,5),uk=rep(1,5))
srs<-svydesign(id=~1, weights=~weights, data=a)
srs1<-svydesign(id=~1, weights=~weights,fpc=~fpc, data=a)
> svydesign
function (ids, probs = NULL, strata = NULL, variables = NULL,
fpc = NULL, data = NULL, nest = FALSE, check.strata = !nest,
weights = NULL, pps = FALSE, ...)
{
UseMethod("svydesign", data)
}
<environment: namespace:survey>
When that happens it means there are more than one function dispatched
by the S3 system. To find out there names use methods()
> methods(svydesign)
[1] svydesign.character* svydesign.DBimputationList*
svydesign.default*
[4] svydesign.imputationList*
Non-visible functions are asterisked
When functions are non-vidible you use getAnywhere:
getAnywhere(svydesign.default)
(Produces a couple of pages of code.)
--
David.
svytotal(~uk,srs)
total SE
uk 41 9
svytotal(~uk,srs1)
total SE
uk 41 8.4334
and does anyone know if it is possible to find the codes for
functions in survey package?
thanks in advance
Andrija
[[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.
______________________________________________
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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.