tests/svyby-strings.R

## check that stringsAsFactors fixes the string levels problem
data(api, package = "survey")
des <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc)
est0 <-
  survey::svyby(design=des, formula=~cname, by=~both, FUN=survey::svymean, keep.var=TRUE, stringsAsFactors=TRUE) 

stopifnot(isTRUE(all(dim(est0)==c(2,23))))

Try the survey package in your browser

Any scripts or data that you put into this service are public.

survey documentation built on May 3, 2023, 9:12 a.m.