tests/degf-subset.R

library(survey)


# Load dataset
data(scd)

# Create rep weights
repweights <- 2 * cbind(
  c(1,0,1,0,1,0), 
  c(1,0,0,1,0,1), 
  c(0,1,1,0,0,1),
  c(0,1,0,1,1,0)
)

scdrep <- svrepdesign(
  data = scd, 
  type = "BRR", 
  repweights = repweights, 
  combined.weights = FALSE,
  degf = 2
)


df1<-scdrep$degf

scdsub<-subset(
  x = scdrep,
  arrests >= 200
)


stopifnot(identical(scdrep$degf, scdsub$degf))

Try the survey package in your browser

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

survey documentation built on Feb. 25, 2026, 3 a.m.