[R] Sample Weights

Reed, Richard W Richard.Reed at med.va.gov
Sun Mar 30 21:21:15 CEST 2003


Dear R Users--

	I am trying to apply a sample weight variable to my calculations.
The dataset is from the Department of Labor. I believe that NORC constructed
the sample and did the sampling. They sampled nearly 17,000 young adults.
The sample weight variable converts the sample into the 34,000,000 in the US
population that they represent. I imported AFQT from SPSS. When I query,
"is.data.frame(AFQT)" the answer is TRUE.

	I am trying to apply svydesign from the Survey Package:

svydesign(ids, probs=NULL, strata = NULL, variables = NULL, fpc=NULL, data =
NULL, nest = FALSE, check.strata = !nest, weights=NULL) 

Below represents my effort to apply the function and the error message
(which I don't understand).
> AFQTs<-svydesign(id=~0,weights=AFQT$ASVABSW,data=AFQT)
Error in apply(probs, 1, prod) : dim(X) must have a positive length
Thanks for your help--
Richard



More information about the R-help mailing list