Need help in getting confidence interval through srvyr package

I keep getting an error message of:
"Error in str2lang(x) : :2:0: unexpected end of input
1: ~
^"
when I run the code below at the function as_survey -- I'm seeking the margin of error of the subset LIHTC of a data table. Ideas?

install.packages("tidyverse")
install.packages("srvyr")
install.packages("readxl")
library(tidyverse)
library(srvyr)
library(readxl)

hhRaw <- read_excel("D:/mhp3/qualnvhhs.xlsx")

svy <-as_survey(hhRaw,
weight =PERWT ,
repweights =matches("REPWTP[0-9]+"),
type ="JK1",
scale =4/80,
rscales =rep(1,80),
mse =TRUE)

LIHTC_svy %>% filter(OverLIHTC == 1) %>%
summarise(LIHTC=survey_total(vartype="ci")) %>%
mutate(LIHTC_Percent = LIHTC / survey_total()*100) %>%
select(LIHTC_Percent, LIHTC)

I think we need to see some sample data.
A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here between
```

```

YEAR MULTYEAR SAMPLE SERIAL CBSERIAL NUMPREC HHWT CLUSTER STATEFIP COUNTYFIP MET2013OLD MET2013 METPOP10 PCTMETRO PUMA STRATA GQ OWNERSHP OWNERSHPD RENTGRS HHINCOME VACANCY BEDROOMS PERNUM PERWT PWPUMA00 IF_HHs_Qual OverLIHTC OverLIHTCtxt
2021 2021 202103 3759112 2.021E+12 2 4 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 980 1400 0 3 1 4 0 TRUE 0 FALSE
2021 2021 202103 3759179 2.021E+12 5 14 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 880 13950 0 4 1 14 0 TRUE 0 FALSE
2021 2021 202103 3759260 2.021E+12 1 19 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 610 18900 0 2 1 19 0 TRUE 0 FALSE
2021 2021 202103 3759383 2.021E+12 2 4 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1502 0 0 3 1 4 0 TRUE 1 TRUE
2021 2021 202103 3759397 2.021E+12 1 14 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 570 29400 0 2 1 14 0 TRUE 0 FALSE
2021 2021 202103 3759589 2.021E+12 1 33 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 650 15100 0 5 1 32 200 TRUE 0 FALSE
2021 2021 202103 3759639 2.021E+12 1 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 480 24000 0 2 1 11 0 TRUE 0 FALSE
2021 2021 202103 3759769 2.021E+12 2 23 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 780 12200 0 3 1 23 0 TRUE 0 FALSE
2021 2021 202103 3759804 2.021E+12 1 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 0 0 4 1 8 0 TRUE 0 FALSE
2021 2021 202103 3759855 2.021E+12 1 25 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1040 11500 0 3 1 24 0 TRUE 0 FALSE
2021 2021 202103 3760426 2.021E+12 3 6 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 230 22850 0 4 1 6 200 TRUE 0 FALSE
2021 2021 202103 3760518 2.021E+12 1 1 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 404 9800 0 3 1 2 0 TRUE 0 FALSE
2021 2021 202103 3760621 2.021E+12 2 1 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 345 12600 0 4 1 2 0 TRUE 0 FALSE
2021 2021 202103 3760686 2.021E+12 2 25 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 2140 36600 0 5 1 25 200 TRUE 1 TRUE
2021 2021 202103 3760718 2.021E+12 1 10 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 910 31700 0 3 1 10 0 TRUE 0 FALSE
2021 2021 202103 3760776 2.021E+12 2 1 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 594 13400 0 4 1 1 200 TRUE 0 FALSE
2021 2021 202103 3760803 2.021E+12 1 52 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 650 15000 0 1 1 51 200 TRUE 0 FALSE
2021 2021 202103 3760929 2.021E+12 2 2 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 5600 0 3 1 2 0 TRUE 0 FALSE
2021 2021 202103 3761223 2.021E+12 1 32 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 220 0 0 1 1 32 0 TRUE 0 FALSE
2021 2021 202103 3761312 2.021E+12 4 23 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1160 32500 0 3 1 23 0 TRUE 1 TRUE
2021 2021 202103 3761601 2.021E+12 3 72 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1090 23000 0 3 1 72 200 TRUE 1 TRUE
2021 2021 202103 3761617 2.021E+12 1 15 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 760 13420 0 2 1 14 0 TRUE 0 FALSE
2021 2021 202103 3761718 2.021E+12 4 2 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 325 6000 0 4 1 2 0 TRUE 0 FALSE
2021 2021 202103 3761807 2.021E+12 2 39 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1000 30000 0 4 1 39 200 TRUE 0 FALSE
2021 2021 202103 3761860 2.021E+12 1 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 2420 18000 0 2 1 16 0 TRUE 1 TRUE
2021 2021 202103 3762093 2.021E+12 4 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 800 35600 0 3 1 16 200 TRUE 0 FALSE
2021 2021 202103 3762125 2.021E+12 4 6 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 900 42000 0 6 1 6 100 TRUE 0 FALSE
2021 2021 202103 3762302 2.021E+12 1 6 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 442 540 0 3 1 6 0 TRUE 0 FALSE
2021 2021 202103 3762715 2.021E+12 1 107 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 810 31800 0 1 1 107 0 TRUE 0 FALSE
2021 2021 202103 3762843 2.021E+12 2 15 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1238 31200 0 3 1 15 100 TRUE 1 TRUE
2021 2021 202103 3762846 2.021E+12 2 10 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 990 31000 0 3 1 9 200 TRUE 0 FALSE
2021 2021 202103 3762847 2.021E+12 2 17 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1000 23500 0 4 1 16 200 TRUE 0 FALSE
2021 2021 202103 3762902 2.021E+12 2 53 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 130 0 0 3 1 53 0 TRUE 0 FALSE
2021 2021 202103 3763189 2.021E+12 1 15 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 720 25000 0 2 1 14 200 TRUE 0 FALSE
2021 2021 202103 3763347 2.021E+12 1 9 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 960 10000 0 3 1 10 0 TRUE 0 FALSE
2021 2021 202103 3763419 2.021E+12 5 13 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1210 47600 0 3 1 13 200 TRUE 1 TRUE
2021 2021 202103 3763556 2.021E+12 1 18 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 310 9400 0 1 1 17 0 TRUE 0 FALSE
2021 2021 202103 3763891 2.021E+12 1 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 10000 0 3 1 7 0 TRUE 0 FALSE
2021 2021 202103 3763953 2.021E+12 5 13 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1110 48400 0 3 1 14 100 TRUE 1 TRUE
2021 2021 202103 3763960 2.021E+12 1 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1780 790 0 4 1 7 0 TRUE 1 TRUE
2021 2021 202103 3764358 2.021E+12 1 14 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1270 30000 0 3 1 15 200 TRUE 1 TRUE
2021 2021 202103 3764525 2.021E+12 2 4 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 960 16800 0 3 1 4 0 TRUE 0 FALSE
2021 2021 202103 3764575 2.021E+12 1 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 380 0 0 2 1 11 0 TRUE 0 FALSE
2021 2021 202103 3764874 2.021E+12 4 2 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1462 30000 0 5 1 3 0 TRUE 1 TRUE
2021 2021 202103 3764991 2.021E+12 1 15 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 410 1380 0 2 1 15 0 TRUE 0 FALSE
2021 2021 202103 3765176 2.021E+12 5 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1140 17500 0 3 1 16 1700 TRUE 1 TRUE
2021 2021 202103 3765284 2.021E+12 2 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1410 9500 0 1 1 10 0 TRUE 1 TRUE
2021 2021 202103 3765383 2.021E+12 1 12 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 905 20000 0 3 1 12 100 TRUE 0 FALSE
2021 2021 202103 3765421 2.021E+12 1 30 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 350 14000 0 1 1 30 0 TRUE 0 FALSE
2021 2021 202103 3765425 2.021E+12 1 12 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 390 15600 0 3 1 12 0 TRUE 0 FALSE
2021 2021 202103 3765599 2.021E+12 2 5 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1110 16200 0 1 1 6 0 TRUE 1 TRUE
2021 2021 202103 3765964 2.021E+12 1 102 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 840 30000 0 1 1 102 100 TRUE 1 TRUE
2021 2021 202103 3766097 2.021E+12 5 61 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 620 19600 0 4 1 61 200 TRUE 0 FALSE
2021 2021 202103 3766144 2.021E+12 2 9 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 673 13700 0 3 1 8 0 TRUE 0 FALSE
2021 2021 202103 3766402 2.021E+12 2 17 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1038 31600 0 3 1 17 0 TRUE 0 FALSE
2021 2021 202103 3766418 2.021E+12 1 36 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 760 0 0 2 1 35 0 TRUE 0 FALSE
2021 2021 202103 3766509 2.021E+12 3 48 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 140 20000 0 4 1 48 0 TRUE 0 FALSE
2021 2021 202103 3766597 2.021E+12 1 19 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 880 12300 0 3 1 19 0 TRUE 0 FALSE
2021 2021 202103 3766754 2.021E+12 1 42 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 320 10700 0 2 1 43 200 TRUE 0 FALSE
2021 2021 202103 3766760 2.021E+12 1 34 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1580 19300 0 4 1 34 0 TRUE 1 TRUE
2021 2021 202103 3766978 2.021E+12 1 31 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 780 30000 0 2 1 32 200 TRUE 0 FALSE
2021 2021 202103 3767090 2.021E+12 1 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 830 13000 0 2 1 16 0 TRUE 0 FALSE
2021 2021 202103 3767211 2.021E+12 1 2 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 440 19600 0 2 1 2 0 TRUE 0 FALSE
2021 2021 202103 3767336 2.021E+12 3 12 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 440 15600 0 2 1 12 0 TRUE 0 FALSE
2021 2021 202103 3767508 2.021E+12 4 13 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 975 42200 0 3 1 14 200 TRUE 0 FALSE
2021 2021 202103 3767516 2.021E+12 1 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 630 20000 0 3 1 7 200 TRUE 0 FALSE
2021 2021 202103 3767659 2.021E+12 5 15 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1048 6000 0 5 1 14 200 TRUE 0 FALSE
2021 2021 202103 3767769 2.021E+12 1 12 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1180 21900 0 3 1 12 0 TRUE 1 TRUE
2021 2021 202103 3767943 2.021E+12 1 8 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 940 40 0 3 1 9 200 TRUE 0 FALSE
2021 2021 202103 3767957 2.021E+12 4 22 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 1200 0 4 1 23 0 TRUE 0 FALSE
2021 2021 202103 3768180 2.021E+12 1 36 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 30000 0 4 1 36 200 TRUE 0 FALSE
2021 2021 202103 3768407 2.021E+12 1 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 680 6500 0 3 1 15 0 TRUE 0 FALSE
2021 2021 202103 3768522 2.021E+12 1 8 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 740 27040 0 3 1 7 200 TRUE 0 FALSE
2021 2021 202103 3768576 2.021E+12 1 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 560 17500 0 3 1 11 100 TRUE 0 FALSE
2021 2021 202103 3768582 2.021E+12 4 20 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 757 32400 0 4 1 20 200 TRUE 0 FALSE
2021 2021 202103 3769028 2.021E+12 1 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1500 1100 0 4 1 8 0 TRUE 1 TRUE
2021 2021 202103 3769132 2.021E+12 1 22 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 597 19300 0 2 1 21 0 TRUE 0 FALSE
2021 2021 202103 3769197 2.021E+12 1 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 820 11700 0 3 1 11 200 TRUE 0 FALSE
2021 2021 202103 3769378 2.021E+12 1 22 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 730 6300 0 2 1 22 0 TRUE 0 FALSE
2021 2021 202103 3769872 2.021E+12 1 14 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 920 6600 0 2 1 14 0 TRUE 1 TRUE
2021 2021 202103 3769877 2.021E+12 1 65 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 780 17000 0 1 1 66 200 TRUE 0 FALSE
2021 2021 202103 3769974 2.021E+12 1 27 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 230 9600 0 1 1 27 0 TRUE 0 FALSE
2021 2021 202103 3770038 2.021E+12 1 27 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 880 21600 0 3 1 27 0 TRUE 0 FALSE
2021 2020 202103 3749709 2.02E+12 3 16 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1078 5233 0 3 1 16 200 TRUE 1 TRUE
2021 2020 202103 3750012 2.02E+12 2 58 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 9839 0 4 1 57 0 TRUE 0 FALSE
2021 2020 202103 3750067 2.02E+12 1 9 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 816 12655 0 2 1 8 0 TRUE 0 FALSE
2021 2020 202103 3750121 2.02E+12 2 1 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 598 35797 0 4 1 1 200 TRUE 0 FALSE
2021 2020 202103 3750124 2.02E+12 1 9 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 952 15700 0 2 1 9 100 TRUE 1 TRUE
2021 2020 202103 3750149 2.02E+12 2 4 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 21 0 12665 0 4 1 4 0 TRUE 0 FALSE
2021 2020 202103 3750240 2.02E+12 1 18 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 848 11514 0 2 1 17 0 TRUE 0 FALSE
2021 2020 202103 3750306 2.02E+12 1 11 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 795 10886 0 2 1 12 0 TRUE 0 FALSE
2021 2020 202103 3750460 2.02E+12 4 14 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1926 33599 0 4 1 14 200 TRUE 1 TRUE
2021 2020 202103 3750724 2.02E+12 1 120 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 576 22399 0 2 1 120 0 TRUE 0 FALSE
2021 2020 202103 3750727 2.02E+12 1 4 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 973 20934 0 3 1 3 200 TRUE 0 FALSE
2021 2020 202103 3751201 2.02E+12 1 1 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 505 10258 0 3 1 1 0 TRUE 0 FALSE
2021 2020 202103 3751449 2.02E+12 3 27 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1675 32448 0 4 1 27 200 TRUE 1 TRUE
2021 2020 202103 3751503 2.02E+12 1 38 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 712 2512 0 3 1 38 0 TRUE 0 FALSE
2021 2020 202103 3751724 2.02E+12 4 7 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1235 31401 0 4 1 7 200 TRUE 1 TRUE
2021 2020 202103 3751785 2.02E+12 2 2 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 1713 9316 0 5 1 1 200 TRUE 1 TRUE
2021 2020 202103 3751805 2.02E+12 1 6 2.02104E+12 32 0 0 39901 54362 37.46 200 20032 1 2 22 890 5233 0 2 1 7 0 TRUE 1 TRUE

The 100 rows of data are taken from the Excel spreadsheet, called up in Rstudio. Does that work? When I tried the dput function I could not get the data in a way that made sense, to me anyway.

Thanks, that works. It is a bit more trouble to read in but the data look fine.

Here is a small example of what you get with dput.

Sample data.frame

dat1  <-data.frame(aa = LETTERS[1:20], bb = 1:20, cc = rnorm(20))
dput(dat1)

Output

structure(list(aa = c("A", "B", "C", "D", "E", "F", "G", "H", 
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"), 
    bb = 1:20, cc = c(0.458515372906237, -0.99227635151903, -1.33823108853026, 
    -0.325373707421581, 0.649016059978152, 0.514246750775234, 
    -0.426903784341409, 1.88510753699928, -0.20366184308145, 
    0.933520813229627, -0.0726434861539438, 0.984463888348629, 
    -1.20975546788746, 1.40643517165563, 0.318122801594033, 0.880096498988723, 
    -1.84513624048591, -0.708588471245333, -0.628075880383442, 
    1.18399159545685)), class = "data.frame", row.names = c(NA, 
-20L))

What is this doing?

repweights = matches("REPWTP[0-9]+")

I am getting an error here.

This runs

svy <-as_survey(hhRaw,
weight =PERWT ,
type ="JK1",
scale =4/80,
rscales =rep(1,80),
mse =TRUE)

You have a data.frame

LIHTC_svy

that appears from no-where.

Have a look at FAQ Asking Questions

Oops, in the code above the line:
svy <-as_survey(hhRaw, should be LIHTC_svy <- as_survey(hhRaw, ...

Regarding the other point, on repweights = matches("REPWTP[0-9]+") I'm taking code from the IPUMS (UofMN) that produced the table data for which I'm trying to find a margin of error. Their code for R with repweights = is found at IPUMS USA

Thanks for your help!

I'm guessing here as I have never used the {srvyr} or {survey} packages but in looks like the dataset data in

svy <- as_survey(data, weight = PERWT , repweights = matches("REPWTP[0-9]+"),
      type = "JK1", scale = 4/ 80 , rscales = rep(1, 80 ), mse = TRUE)

has replicate weights in it and

repweights = matches("REPWTP[0-9]+")

is simply a regex ( regular expression) that is selecting the ones to use.

Here is an example from Create a tbl_svy survey object using replicate weights

library(survey)
library(dplyr)
data(scd)

scd <- scd %>%
  mutate(rep1 = 2 * c(1, 0, 1, 0, 1, 0),
         rep2 = 2 * c(1, 0, 0, 1, 0, 1),
         rep3 = 2 * c(0, 1, 1, 0, 0, 1),
         rep4 = 2 * c(0, 1, 0, 1, 1, 0))

scdrep <- scd %>%
  as_survey_rep(type = "BRR", repweights = starts_with("rep"),
                combined_weights = FALSE)

Does it look like the IPUMS USA data has replicate weights?

It is not in the data file I sent; I'm contacting IPUMS to see if it is in/connected to the srvyr package.

IPUMS clarified that the replicate weights are only added if I add the repwt variable in the data extract. I did not do this. I'll add the variable in a new extract and see what happens.

Here is the code with the replicate variables added, also with 100 lines I exceeded the allowed input so I had to cut back to 60.

dput(head(hhRaw, 60))
structure(list(YEAR = c(2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021), MULTYEAR = c(2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018,
2018, 2018, 2018, 2018), SAMPLE = c(202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103,
202103, 202103, 202103, 202103, 202103, 202103, 202103, 202103
), SERIAL = c(3712016, 3712227, 3712383, 3712447, 3712616, 3712725,
3713015, 3713318, 3713417, 3713850, 3713981, 3714036, 3714389,
3715254, 3715379, 3715565, 3715566, 3715674, 3716227, 3716384,
3717110, 3717441, 3717473, 3717592, 3717716, 3717966, 3717996,
3718261, 3718357, 3718648, 3718673, 3718874, 3719034, 3719173,
3719733, 3719750, 3719835, 3719842, 3719900, 3719920, 3720792,
3721008, 3721477, 3721599, 3721761, 3721990, 3722175, 3722351,
3722395, 3722414, 3722742, 3724103, 3724128, 3724217, 3724376,
3724532, 3724736, 3725034, 3725060, 3725150), CBSERIAL = c(2017000068404,
2017000094511, 2017000113905, 2017000121833, 2017000140613, 2017000152182,
2017000192839, 2017000229262, 2017000240042, 2017000297515, 2017000314851,
2017000320277, 2017000363650, 2017000464978, 2017000477783, 2017000499664,
2017000499758, 2017000512437, 2017000580856, 2017000600029, 2017000682973,
2017000720637, 2017000725130, 2017000739638, 2017000753244, 2017000783501,
2017000786750, 2017000819044, 2017000829302, 2017000862085, 2017000865716,
2017000890777, 2017000910554, 2017000928571, 2017001000710, 2017001002415,
2017001014341, 2017001014639, 2017001022592, 2017001024457, 2017001131896,
2017001158546, 2017001214552, 2017001229124, 2017001249803, 2017001279972,
2017001302101, 2017001323469, 2017001329894, 2017001332574, 2017001369700,
2018000015380, 2018000019251, 2018000030609, 2018000050288, 2018000070432,
2018000095784, 2018000128840, 2018000132919, 2018000144377),
OverLIHTC = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0), HHWT = c(34, 50, 34, 23, 53, 1, 9,
27, 17, 18, 1, 27, 17, 2, 15, 17, 11, 2, 26, 10, 13, 2, 17,
16, 27, 10, 35, 13, 26, 19, 23, 23, 34, 20, 40, 22, 19, 32,
26, 16, 12, 3, 39, 15, 17, 25, 3, 46, 2, 6, 21, 17, 3, 18,
38, 14, 38, 11, 21, 17), REPWT = c(1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CLUSTER = c(2021037120163,
2021037122273, 2021037123833, 2021037124473, 2021037126163,
2021037127253, 2021037130153, 2021037133183, 2021037134173,
2021037138503, 2021037139813, 2021037140363, 2021037143893,
2021037152543, 2021037153793, 2021037155653, 2021037155663,
2021037156743, 2021037162273, 2021037163843, 2021037171103,
2021037174413, 2021037174733, 2021037175923, 2021037177163,
2021037179663, 2021037179963, 2021037182613, 2021037183573,
2021037186483, 2021037186733, 2021037188743, 2021037190343,
2021037191733, 2021037197333, 2021037197503, 2021037198353,
2021037198423, 2021037199003, 2021037199203, 2021037207923,
2021037210083, 2021037214773, 2021037215993, 2021037217613,
2021037219903, 2021037221753, 2021037223513, 2021037223953,
2021037224143, 2021037227423, 2021037241033, 2021037241283,
2021037242173, 2021037243763, 2021037245323, 2021037247363,
2021037250343, 2021037250603, 2021037251503), STATEFIP = c(32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32),
STRATA = c(20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032,
20032, 20032, 20032, 20032, 20032, 20032, 20032, 20032),
GQ = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1), REPWT1 = c(25, 74, 32, 43, 25, 0, 11, 11,
26, 18, 1, 26, 25, 0, 18, 4, 13, 2, 27, 14, 4, 3, 5, 6, 26,
10, 49, 16, 11, 23, 35, 35, 26, 17, 60, 19, 23, 30, 40, 5,
14, 2, 33, 30, 22, 30, 1, 82, 3, 7, 20, 16, 1, 15, 64, 15,
35, 9, 6, 15), REPWT2 = c(28, 45, 95, 39, 112, 2, 2, 22,
6, 14, 3, 38, 16, 2, 31, 17, 4, 1, 32, 13, 5, 3, 5, 26, 33,
7, 42, 19, 9, 6, 34, 23, 12, 23, 42, 10, 25, 42, 38, 18,
13, 1, 43, 18, 17, 41, 3, 16, 2, 6, 5, 6, 5, 29, 36, 24,
38, 4, 26, 4), REPWT3 = c(55, 12, 15, 14, 38, 2, 8, 7, 21,
26, 2, 32, 5, 2, 17, 12, 11, 3, 39, 3, 3, 0, 32, 14, 27,
15, 15, 3, 9, 20, 28, 24, 63, 17, 47, 23, 8, 26, 20, 18,
4, 1, 67, 27, 22, 26, 3, 12, 1, 5, 25, 17, 4, 28, 76, 12,
55, 3, 27, 5), REPWT4 = c(46, 48, 36, 27, 44, 4, 14, 31,
33, 20, 0, 35, 15, 3, 14, 12, 11, 3, 23, 18, 12, 4, 30, 16,
27, 10, 9, 14, 37, 18, 24, 39, 58, 5, 68, 32, 26, 11, 36,
15, 20, 3, 55, 17, 13, 23, 0, 49, 3, 11, 23, 28, 4, 23, 46,
24, 41, 15, 6, 6), REPWT5 = c(39, 53, 31, 25, 81, 3, 12,
10, 25, 7, 1, 25, 25, 1, 16, 27, 23, 2, 40, 10, 14, 3, 17,
17, 24, 2, 36, 24, 26, 5, 31, 27, 32, 18, 53, 26, 29, 89,
28, 27, 3, 2, 12, 15, 16, 23, 1, 12, 1, 11, 6, 17, 3, 22,
65, 12, 71, 6, 25, 15), REPWT6 = c(18, 49, 64, 24, 18, 1,
12, 30, 22, 16, 2, 34, 22, 2, 15, 21, 18, 4, 7, 11, 14, 3,
26, 5, 8, 8, 29, 17, 23, 20, 5, 7, 46, 6, 74, 25, 20, 36,
40, 25, 13, 1, 58, 25, 36, 6, 1, 41, 2, 7, 26, 4, 1, 7, 73,
15, 37, 12, 6, 23), REPWT7 = c(79, 13, 57, 38, 67, 2, 10,
29, 14, 5, 1, 29, 16, 0, 26, 29, 4, 2, 25, 11, 15, 8, 14,
34, 12, 3, 39, 22, 20, 43, 17, 7, 40, 24, 42, 16, 22, 28,
21, 25, 20, 3, 41, 15, 18, 27, 1, 37, 1, 7, 35, 6, 4, 6,
32, 14, 41, 16, 29, 22), REPWT8 = c(11, 53, 36, 6, 56, 1,
9, 34, 14, 7, 2, 31, 24, 2, 17, 20, 3, 2, 29, 3, 15, 2, 16,
16, 5, 2, 37, 5, 23, 5, 41, 6, 16, 21, 38, 32, 35, 11, 33,
30, 22, 5, 51, 5, 5, 6, 2, 64, 0, 5, 29, 18, 6, 22, 14, 4,
60, 22, 36, 6), REPWT9 = c(11, 18, 5, 11, 58, 4, 9, 28, 19,
33, 2, 30, 19, 4, 9, 22, 19, 2, 25, 19, 23, 3, 5, 14, 34,
15, 36, 9, 25, 5, 17, 24, 34, 7, 47, 17, 27, 22, 18, 7, 21,
1, 11, 26, 37, 29, 0, 43, 1, 13, 35, 20, 3, 7, 64, 12, 42,
29, 22, 23), REPWT10 = c(29, 92, 21, 8, 24, 2, 9, 11, 22,
23, 2, 7, 5, 3, 3, 24, 11, 2, 8, 11, 26, 1, 14, 5, 57, 11,
54, 11, 51, 40, 52, 33, 52, 20, 16, 38, 7, 12, 8, 24, 10,
0, 11, 25, 21, 19, 2, 70, 2, 2, 19, 6, 1, 36, 52, 4, 14,
17, 20, 17), REPWT11 = c(23, 48, 19, 20, 50, 3, 11, 13, 4,
31, 1, 8, 5, 3, 3, 17, 4, 2, 30, 9, 23, 6, 8, 13, 25, 10,
36, 28, 49, 22, 36, 19, 35, 33, 38, 9, 7, 13, 29, 4, 3, 1,
14, 5, 4, 5, 1, 52, 1, 11, 29, 28, 3, 10, 18, 14, 67, 10,
22, 5), REPWT12 = c(63, 74, 58, 27, 18, 0, 2, 36, 19, 19,
1, 9, 4, 2, 20, 7, 16, 0, 31, 3, 16, 0, 24, 5, 9, 8, 12,
14, 38, 16, 8, 23, 72, 8, 11, 20, 6, 62, 7, 18, 23, 3, 43,
15, 22, 35, 2, 65, 2, 6, 24, 14, 1, 27, 44, 14, 48, 17, 8,
23), REPWT13 = c(64, 50, 16, 30, 21, 1, 3, 23, 24, 18, 1,
27, 14, 0, 29, 27, 20, 1, 25, 10, 5, 0, 4, 6, 43, 10, 52,
21, 9, 41, 17, 22, 47, 9, 42, 5, 13, 52, 24, 4, 14, 4, 42,
15, 16, 59, 4, 37, 1, 2, 21, 30, 0, 16, 33, 5, 10, 4, 20,
29), REPWT14 = c(14, 53, 9, 6, 52, 5, 3, 9, 7, 34, 3, 42,
17, 3, 4, 26, 11, 1, 9, 3, 11, 4, 25, 22, 30, 18, 32, 17,
24, 22, 4, 36, 10, 35, 26, 15, 24, 29, 30, 4, 11, 3, 60,
5, 5, 9, 3, 48, 1, 3, 20, 30, 6, 29, 9, 14, 39, 17, 35, 38
), REPWT15 = c(28, 44, 29, 19, 105, 3, 8, 37, 15, 19, 1,
28, 14, 2, 14, 5, 13, 2, 10, 3, 22, 2, 16, 26, 8, 9, 49,
5, 41, 28, 23, 39, 32, 21, 9, 13, 19, 36, 7, 16, 15, 2, 15,
18, 17, 7, 3, 13, 2, 2, 6, 21, 6, 27, 33, 22, 29, 10, 15,
28), REPWT16 = c(51, 68, 15, 26, 66, 1, 17, 24, 4, 30, 2,
8, 24, 2, 33, 22, 4, 3, 34, 17, 14, 3, 27, 15, 31, 11, 35,
3, 26, 15, 26, 34, 11, 27, 32, 19, 26, 29, 34, 13, 15, 3,
40, 4, 6, 36, 1, 43, 2, 7, 9, 42, 4, 19, 13, 4, 11, 5, 32,
17), REPWT17 = c(58, 59, 27, 9, 34, 2, 11, 10, 21, 5, 0,
20, 26, 2, 4, 18, 10, 2, 30, 15, 22, 5, 23, 18, 65, 3, 12,
13, 36, 19, 6, 23, 28, 46, 57, 9, 23, 33, 41, 15, 3, 3, 70,
14, 17, 25, 1, 47, 2, 11, 8, 6, 3, 22, 44, 4, 46, 12, 54,
23), REPWT18 = c(14, 18, 39, 37, 36, 5, 2, 11, 25, 8, 2,
23, 26, 2, 4, 4, 11, 0, 8, 10, 27, 2, 15, 15, 49, 2, 26,
13, 49, 22, 24, 7, 33, 19, 11, 8, 33, 8, 9, 17, 4, 4, 48,
15, 16, 19, 3, 15, 1, 2, 17, 16, 2, 25, 34, 24, 11, 12, 6,
16), REPWT19 = c(61, 63, 30, 42, 40, 0, 10, 8, 14, 25, 2,
9, 28, 0, 15, 18, 11, 3, 40, 10, 9, 2, 30, 18, 42, 9, 14,
9, 26, 6, 11, 24, 9, 26, 13, 40, 32, 36, 7, 23, 11, 3, 33,
12, 17, 48, 2, 80, 2, 9, 34, 17, 2, 18, 39, 13, 43, 19, 21,
21), REPWT20 = c(66, 55, 40, 5, 104, 1, 2, 26, 6, 15, 2,
45, 32, 1, 18, 6, 10, 1, 24, 19, 21, 1, 4, 31, 6, 9, 64,
3, 30, 5, 18, 5, 38, 4, 56, 40, 37, 8, 7, 18, 4, 3, 60, 21,
6, 8, 3, 83, 1, 6, 42, 16, 5, 23, 56, 4, 76, 18, 19, 22),
REPWT21 = c(38, 55, 97, 8, 16, 3, 9, 19, 23, 17, 1, 30, 7,
2, 18, 5, 10, 2, 27, 8, 26, 2, 19, 5, 29, 10, 46, 10, 47,
18, 31, 37, 35, 20, 71, 33, 4, 29, 10, 15, 4, 2, 59, 4, 34,
22, 3, 49, 1, 6, 24, 16, 1, 25, 14, 11, 39, 17, 32, 15),
REPWT22 = c(43, 81, 58, 8, 78, 2, 14, 40, 5, 18, 3, 41, 15,
0, 29, 14, 17, 3, 7, 9, 20, 2, 18, 32, 27, 9, 29, 18, 38,
37, 36, 21, 10, 19, 46, 20, 21, 43, 34, 31, 16, 1, 71, 15,
15, 7, 5, 49, 3, 6, 7, 29, 5, 20, 29, 3, 36, 9, 23, 4), REPWT23 = c(57,
47, 45, 21, 66, 2, 8, 26, 16, 29, 3, 47, 25, 1, 21, 19, 14,
2, 6, 3, 24, 5, 15, 17, 27, 16, 8, 4, 41, 25, 22, 21, 49,
18, 39, 5, 32, 29, 31, 6, 11, 0, 44, 5, 31, 26, 5, 58, 2,
6, 21, 20, 5, 7, 15, 13, 13, 9, 16, 6), REPWT24 = c(37, 88,
45, 18, 49, 0, 3, 35, 37, 16, 1, 44, 15, 4, 15, 14, 10, 0,
28, 17, 10, 3, 16, 18, 21, 7, 12, 13, 22, 18, 24, 45, 56,
32, 63, 25, 17, 49, 8, 5, 11, 3, 63, 12, 14, 25, 2, 71, 0,
10, 17, 4, 3, 24, 48, 3, 34, 10, 35, 6), REPWT25 = c(28,
79, 12, 15, 69, 1, 2, 29, 23, 6, 0, 28, 6, 2, 15, 28, 4,
1, 8, 11, 11, 2, 5, 15, 28, 2, 23, 14, 26, 28, 23, 25, 37,
17, 49, 8, 7, 11, 25, 17, 11, 4, 41, 15, 17, 18, 4, 43, 2,
10, 8, 14, 2, 42, 39, 16, 10, 11, 21, 18), REPWT26 = c(9,
16, 35, 20, 25, 1, 3, 33, 19, 12, 1, 30, 19, 1, 15, 17, 4,
0, 42, 9, 17, 3, 18, 4, 52, 10, 46, 17, 26, 26, 10, 7, 30,
38, 74, 9, 16, 34, 9, 15, 18, 1, 47, 5, 28, 52, 3, 19, 0,
7, 20, 28, 1, 18, 14, 13, 32, 3, 34, 33), REPWT27 = c(52,
50, 14, 20, 109, 2, 10, 36, 20, 5, 3, 26, 18, 1, 23, 25,
18, 2, 31, 11, 14, 1, 35, 23, 41, 2, 47, 16, 24, 5, 22, 8,
34, 21, 50, 31, 16, 25, 31, 23, 14, 3, 11, 14, 15, 30, 2,
73, 2, 6, 34, 28, 6, 15, 41, 11, 38, 19, 8, 18), REPWT28 = c(15,
18, 18, 56, 48, 1, 8, 54, 14, 7, 2, 27, 6, 4, 13, 21, 16,
2, 27, 2, 13, 2, 6, 15, 41, 2, 31, 4, 32, 31, 39, 6, 15,
19, 36, 22, 5, 48, 27, 19, 12, 5, 44, 25, 6, 31, 4, 48, 2,
6, 46, 18, 5, 6, 72, 20, 13, 9, 7, 5), REPWT29 = c(14, 53,
31, 33, 42, 1, 10, 33, 19, 21, 0, 22, 18, 2, 10, 14, 2, 1,
30, 11, 4, 4, 15, 21, 23, 21, 47, 16, 11, 50, 32, 23, 33,
35, 41, 24, 18, 34, 15, 17, 11, 1, 44, 5, 25, 29, 3, 75,
1, 9, 37, 15, 2, 20, 10, 14, 42, 9, 22, 17), REPWT30 = c(32,
54, 7, 35, 13, 2, 8, 28, 16, 16, 3, 7, 26, 1, 4, 21, 11,
2, 41, 9, 3, 3, 6, 5, 7, 9, 52, 12, 10, 6, 28, 27, 74, 19,
16, 27, 22, 51, 40, 16, 5, 1, 42, 4, 22, 15, 5, 54, 2, 1,
22, 32, 0, 14, 10, 22, 54, 11, 22, 20), REPWT31 = c(45, 14,
39, 25, 42, 2, 8, 28, 5, 26, 1, 9, 24, 2, 3, 19, 19, 3, 25,
12, 5, 1, 16, 13, 31, 17, 27, 18, 12, 19, 51, 19, 29, 6,
44, 25, 33, 57, 28, 13, 10, 3, 40, 26, 6, 38, 4, 16, 0, 10,
17, 6, 3, 14, 67, 15, 12, 4, 20, 5), REPWT32 = c(38, 61,
43, 8, 19, 3, 16, 44, 19, 21, 3, 12, 30, 1, 20, 7, 4, 3,
7, 3, 17, 5, 26, 4, 47, 12, 11, 13, 35, 18, 6, 21, 43, 39,
13, 38, 31, 12, 41, 24, 14, 3, 14, 14, 23, 36, 5, 42, 2,
4, 20, 15, 2, 20, 33, 15, 11, 19, 42, 16), REPWT33 = c(45,
16, 45, 30, 23, 3, 20, 45, 30, 20, 2, 28, 17, 2, 38, 27,
4, 3, 25, 10, 22, 3, 16, 5, 21, 6, 63, 24, 40, 7, 24, 21,
58, 29, 55, 29, 16, 12, 31, 15, 16, 4, 70, 19, 17, 9, 5,
16, 1, 2, 20, 7, 2, 4, 28, 19, 55, 13, 27, 28), REPWT34 = c(11,
75, 23, 39, 72, 0, 13, 22, 6, 28, 1, 45, 19, 1, 5, 28, 11,
3, 47, 3, 18, 2, 27, 31, 23, 18, 40, 26, 32, 15, 10, 35,
9, 7, 46, 37, 22, 40, 25, 15, 4, 2, 33, 30, 5, 50, 7, 62,
2, 3, 22, 6, 5, 18, 50, 14, 48, 7, 7, 24), REPWT35 = c(29,
78, 46, 21, 68, 1, 11, 44, 17, 26, 4, 33, 18, 4, 12, 6, 10,
2, 63, 2, 4, 2, 8, 25, 45, 9, 52, 3, 12, 6, 21, 39, 21, 20,
10, 9, 18, 31, 41, 6, 21, 2, 31, 15, 21, 37, 5, 44, 1, 2,
6, 17, 5, 16, 40, 4, 38, 4, 16, 25), REPWT36 = c(29, 49,
50, 22, 61, 3, 4, 41, 6, 31, 1, 8, 14, 0, 31, 14, 24, 1,
31, 16, 13, 1, 17, 21, 28, 13, 51, 3, 15, 24, 23, 31, 8,
24, 35, 10, 19, 35, 36, 5, 23, 2, 23, 27, 5, 11, 2, 19, 2,
8, 5, 5, 5, 33, 58, 25, 75, 10, 7, 21), REPWT37 = c(30, 52,
7, 35, 42, 2, 9, 25, 15, 6, 2, 35, 15, 5, 4, 20, 14, 2, 29,
17, 13, 1, 23, 16, 10, 3, 8, 15, 42, 15, 8, 27, 49, 6, 76,
20, 13, 30, 7, 30, 11, 1, 43, 13, 20, 18, 3, 16, 4, 11, 5,
29, 4, 39, 33, 22, 41, 3, 7, 19), REPWT38 = c(11, 51, 20,
28, 60, 0, 12, 33, 28, 8, 1, 25, 4, 4, 3, 5, 14, 3, 41, 10,
3, 5, 27, 14, 9, 2, 31, 18, 6, 19, 38, 6, 50, 17, 11, 21,
5, 48, 39, 30, 15, 4, 11, 14, 17, 17, 5, 51, 1, 2, 18, 18,
3, 4, 35, 4, 54, 4, 38, 16), REPWT39 = c(32, 17, 57, 10,
66, 3, 9, 33, 15, 31, 2, 8, 5, 2, 16, 17, 11, 2, 8, 10, 18,
2, 12, 12, 11, 11, 12, 13, 17, 29, 6, 22, 19, 7, 12, 20,
6, 8, 42, 5, 5, 3, 11, 19, 16, 8, 4, 59, 0, 7, 38, 17, 4,
5, 35, 15, 36, 16, 21, 16), REPWT40 = c(13, 16, 13, 10, 92,
1, 16, 9, 7, 19, 3, 6, 6, 2, 18, 19, 10, 0, 24, 14, 23, 0,
19, 5, 9, 9, 72, 21, 12, 5, 31, 7, 38, 33, 12, 10, 32, 42,
6, 23, 14, 4, 35, 25, 4, 43, 1, 49, 2, 5, 34, 16, 4, 20,
12, 4, 64, 9, 20, 21), REPWT41 = c(37, 83, 50, 7, 26, 1,
9, 12, 30, 20, 1, 30, 25, 1, 16, 35, 11, 2, 33, 8, 21, 3,
4, 31, 25, 11, 55, 13, 9, 19, 9, 34, 38, 19, 10, 22, 6, 33,
9, 6, 11, 3, 57, 5, 33, 32, 1, 13, 0, 7, 18, 17, 1, 24, 61,
13, 34, 8, 39, 15), REPWT42 = c(37, 51, 16, 7, 110, 2, 2,
29, 5, 22, 1, 8, 17, 2, 6, 19, 4, 4, 36, 10, 22, 3, 7, 4,
24, 9, 38, 4, 11, 39, 5, 28, 44, 22, 42, 20, 15, 37, 32,
14, 14, 1, 50, 14, 21, 30, 2, 56, 0, 6, 7, 23, 5, 19, 41,
4, 35, 3, 26, 6), REPWT43 = c(12, 11, 70, 25, 43, 1, 13,
9, 16, 27, 2, 7, 6, 2, 17, 15, 9, 2, 64, 2, 23, 3, 23, 19,
30, 15, 10, 23, 8, 18, 31, 26, 8, 20, 42, 17, 27, 40, 30,
14, 4, 1, 66, 5, 26, 19, 2, 84, 2, 7, 22, 16, 4, 7, 58, 15,
13, 8, 21, 11), REPWT44 = c(33, 48, 28, 33, 44, 3, 17, 32,
32, 20, 3, 8, 20, 1, 14, 17, 9, 1, 28, 20, 17, 2, 29, 26,
25, 9, 10, 19, 29, 16, 22, 34, 9, 6, 17, 6, 18, 14, 8, 14,
27, 4, 83, 17, 17, 24, 0, 38, 0, 2, 22, 5, 2, 29, 31, 4,
46, 14, 41, 6), REPWT45 = c(32, 45, 34, 26, 101, 2, 15, 9,
26, 6, 1, 26, 27, 0, 19, 5, 22, 0, 40, 13, 16, 2, 17, 13,
45, 3, 39, 15, 21, 35, 24, 20, 36, 31, 44, 15, 5, 63, 30,
23, 5, 5, 14, 17, 17, 25, 1, 72, 1, 2, 5, 19, 3, 37, 36,
15, 12, 3, 21, 15), REPWT46 = c(50, 52, 12, 33, 17, 2, 12,
29, 16, 28, 1, 35, 13, 4, 16, 16, 15, 1, 7, 7, 14, 2, 34,
26, 48, 10, 41, 14, 32, 16, 27, 7, 22, 7, 11, 20, 24, 33,
9, 21, 12, 0, 52, 6, 30, 9, 1, 41, 2, 6, 21, 24, 1, 23, 74,
11, 38, 10, 36, 28), REPWT47 = c(9, 15, 40, 29, 96, 2, 9,
32, 15, 6, 2, 26, 12, 1, 5, 4, 3, 1, 24, 6, 14, 1, 18, 5,
42, 3, 37, 4, 29, 6, 21, 8, 24, 20, 46, 23, 16, 30, 28, 15,
23, 2, 32, 13, 13, 27, 1, 56, 2, 5, 30, 24, 6, 16, 40, 13,
37, 10, 7, 19), REPWT48 = c(67, 43, 58, 33, 62, 2, 7, 21,
18, 4, 1, 30, 28, 2, 14, 20, 4, 2, 27, 2, 13, 3, 20, 16,
43, 3, 41, 22, 26, 35, 9, 7, 52, 27, 43, 11, 4, 9, 32, 35,
22, 3, 39, 20, 5, 8, 3, 16, 3, 6, 45, 18, 5, 4, 12, 23, 13,
22, 6, 4), REPWT49 = c(78, 14, 47, 61, 53, 2, 10, 29, 22,
45, 2, 34, 16, 4, 9, 25, 16, 1, 29, 13, 4, 3, 7, 13, 35,
15, 33, 11, 39, 33, 19, 21, 26, 7, 32, 20, 16, 32, 19, 3,
23, 1, 9, 4, 39, 24, 1, 50, 3, 2, 42, 23, 4, 17, 54, 15,
43, 13, 21, 9), REPWT50 = c(38, 91, 20, 33, 27, 2, 10, 12,
15, 26, 1, 32, 6, 3, 25, 5, 11, 2, 12, 7, 4, 5, 13, 26, 8,
10, 53, 11, 36, 6, 5, 20, 14, 17, 71, 8, 39, 8, 35, 27, 8,
1, 12, 4, 24, 19, 3, 13, 1, 10, 24, 30, 1, 17, 65, 30, 58,
19, 20, 20), REPWT51 = c(49, 51, 18, 28, 52, 2, 11, 10, 4,
34, 3, 40, 5, 4, 19, 21, 4, 2, 22, 13, 5, 1, 3, 17, 40, 17,
32, 4, 37, 25, 7, 30, 36, 39, 49, 30, 30, 10, 22, 6, 4, 3,
12, 30, 6, 5, 1, 44, 1, 2, 18, 5, 3, 22, 11, 16, 13, 10,
22, 5), REPWT52 = c(10, 79, 14, 6, 25, 1, 2, 25, 22, 15,
1, 50, 6, 2, 5, 27, 19, 4, 35, 3, 14, 6, 18, 25, 43, 8, 10,
14, 28, 19, 35, 19, 5, 6, 67, 23, 30, 47, 49, 16, 23, 1,
66, 16, 16, 45, 2, 12, 1, 7, 23, 18, 0, 20, 34, 14, 13, 16,
33, 22), REPWT53 = c(16, 48, 68, 14, 20, 1, 2, 28, 35, 22,
1, 22, 19, 0, 8, 3, 19, 4, 28, 14, 16, 4, 6, 21, 19, 10,
64, 3, 9, 6, 21, 24, 9, 4, 36, 31, 18, 38, 31, 7, 10, 5,
38, 15, 13, 46, 3, 57, 2, 11, 20, 6, 1, 5, 40, 22, 61, 8,
18, 26), REPWT54 = c(46, 56, 39, 43, 85, 4, 3, 12, 5, 39,
0, 9, 16, 4, 28, 5, 10, 2, 10, 2, 14, 3, 17, 5, 27, 19, 33,
3, 24, 23, 30, 41, 55, 33, 41, 22, 18, 31, 23, 5, 11, 2,
67, 26, 5, 6, 3, 49, 3, 9, 24, 5, 7, 20, 11, 13, 33, 24,
7, 25), REPWT55 = c(26, 52, 32, 23, 117, 2, 9, 36, 13, 15,
2, 26, 13, 1, 12, 34, 11, 1, 9, 3, 5, 2, 17, 5, 47, 8, 58,
30, 37, 5, 22, 26, 34, 22, 68, 28, 29, 41, 38, 23, 15, 2,
14, 15, 19, 8, 3, 74, 1, 7, 6, 15, 7, 16, 33, 3, 41, 12,
33, 27), REPWT56 = c(33, 62, 74, 22, 37, 1, 12, 25, 5, 37,
2, 46, 17, 3, 3, 22, 3, 0, 23, 14, 12, 0, 48, 15, 28, 20,
33, 20, 34, 18, 24, 47, 48, 16, 50, 20, 18, 36, 31, 13, 13,
2, 28, 29, 7, 40, 1, 35, 1, 6, 6, 5, 3, 29, 12, 20, 75, 2,
9, 15), REPWT57 = c(25, 70, 29, 27, 43, 2, 9, 10, 20, 6,
3, 22, 18, 1, 22, 13, 8, 2, 31, 11, 15, 0, 16, 15, 10, 3,
10, 13, 21, 18, 32, 23, 51, 32, 10, 33, 19, 41, 10, 17, 4,
2, 74, 16, 13, 21, 1, 43, 1, 2, 6, 26, 4, 35, 40, 19, 41,
9, 5, 13), REPWT58 = c(41, 16, 7, 26, 34, 3, 3, 7, 26, 4,
0, 24, 35, 1, 22, 25, 11, 3, 10, 10, 5, 3, 16, 17, 8, 3,
34, 14, 46, 15, 18, 7, 63, 21, 79, 29, 6, 11, 35, 23, 4,
4, 34, 13, 16, 17, 4, 76, 1, 9, 22, 19, 3, 6, 34, 4, 80,
13, 32, 23), REPWT59 = c(25, 56, 36, 7, 46, 1, 10, 8, 19,
13, 0, 65, 33, 1, 15, 20, 11, 1, 47, 9, 12, 3, 35, 17, 8,
9, 8, 14, 38, 34, 48, 24, 67, 37, 68, 7, 4, 50, 39, 18, 10,
2, 36, 14, 18, 55, 2, 17, 1, 7, 42, 19, 4, 7, 40, 17, 33,
15, 19, 28), REPWT60 = c(11, 59, 39, 30, 84, 1, 2, 33, 8,
28, 1, 6, 24, 1, 14, 24, 12, 3, 21, 15, 5, 4, 5, 3, 39, 9,
51, 19, 28, 35, 17, 7, 30, 5, 12, 20, 6, 10, 41, 14, 3, 2,
68, 6, 4, 12, 2, 15, 2, 5, 37, 17, 3, 8, 58, 24, 10, 32,
20, 40), REPWT61 = c(44, 52, 15, 23, 16, 3, 9, 20, 34, 14,
2, 31, 5, 2, 19, 30, 14, 2, 24, 16, 4, 3, 19, 26, 23, 6,
52, 17, 49, 17, 8, 36, 30, 16, 8, 6, 33, 30, 41, 20, 4, 3,
64, 28, 32, 38, 2, 45, 1, 7, 21, 20, 1, 19, 14, 14, 34, 22,
6, 19), REPWT62 = c(25, 70, 52, 39, 81, 2, 17, 57, 5, 23,
2, 8, 16, 1, 6, 18, 20, 1, 7, 12, 3, 3, 19, 5, 27, 8, 35,
5, 47, 6, 8, 20, 41, 18, 51, 24, 20, 34, 24, 24, 18, 1, 55,
15, 18, 10, 5, 51, 2, 7, 7, 5, 5, 37, 49, 20, 39, 12, 17,
6), REPWT63 = c(10, 46, 48, 27, 42, 2, 9, 32, 14, 43, 0,
9, 28, 0, 18, 19, 12, 2, 10, 3, 3, 1, 20, 15, 21, 16, 13,
21, 35, 20, 25, 22, 11, 18, 30, 49, 6, 25, 24, 5, 14, 1,
36, 22, 31, 21, 7, 48, 2, 8, 19, 19, 3, 22, 10, 13, 60, 10,
30, 5), REPWT64 = c(41, 82, 11, 25, 49, 0, 4, 34, 26, 14,
2, 7, 13, 3, 16, 21, 13, 3, 29, 16, 18, 3, 15, 17, 35, 9,
12, 12, 19, 22, 37, 43, 12, 39, 11, 20, 20, 41, 40, 5, 15,
6, 42, 16, 21, 22, 3, 17, 1, 2, 13, 28, 3, 22, 30, 22, 43,
11, 8, 5), REPWT65 = c(40, 70, 52, 22, 64, 2, 2, 27, 24,
4, 2, 25, 5, 1, 16, 6, 4, 4, 8, 13, 16, 3, 6, 19, 28, 3,
41, 16, 30, 5, 27, 21, 26, 23, 35, 42, 30, 11, 26, 17, 12,
4, 60, 14, 19, 20, 4, 60, 1, 3, 6, 17, 3, 19, 31, 11, 61,
11, 20, 14), REPWT66 = c(70, 17, 37, 19, 29, 3, 2, 28, 17,
17, 3, 34, 17, 2, 20, 18, 4, 3, 42, 11, 15, 4, 16, 23, 8,
8, 22, 13, 31, 22, 34, 7, 60, 28, 10, 40, 19, 35, 39, 15,
15, 1, 31, 29, 27, 45, 2, 77, 3, 8, 26, 7, 1, 6, 12, 17,
41, 5, 6, 22), REPWT67 = c(17, 59, 68, 21, 97, 2, 9, 38,
15, 4, 2, 25, 21, 2, 3, 4, 23, 2, 21, 12, 14, 5, 27, 3, 8,
3, 28, 5, 28, 30, 18, 7, 55, 21, 45, 6, 20, 35, 23, 35, 12,
3, 10, 17, 15, 26, 3, 15, 1, 7, 44, 6, 6, 5, 46, 15, 29,
20, 33, 19), REPWT68 = c(53, 18, 48, 7, 48, 2, 8, 35, 20,
7, 2, 27, 7, 4, 10, 17, 18, 2, 25, 3, 13, 2, 5, 17, 7, 3,
30, 18, 39, 6, 8, 8, 106, 16, 50, 25, 28, 48, 27, 18, 10,
3, 66, 3, 5, 46, 5, 40, 1, 8, 46, 16, 3, 25, 73, 4, 49, 12,
38, 5), REPWT69 = c(60, 68, 27, 6, 39, 0, 12, 45, 16, 38,
3, 29, 16, 3, 11, 13, 4, 2, 29, 19, 24, 1, 21, 13, 29, 12,
31, 11, 22, 5, 35, 23, 54, 38, 31, 9, 21, 37, 21, 14, 12,
1, 58, 24, 21, 23, 2, 18, 2, 2, 37, 24, 2, 6, 17, 12, 42,
16, 26, 16), REPWT70 = c(36, 64, 42, 7, 11, 2, 5, 29, 19,
15, 0, 40, 22, 1, 16, 4, 13, 3, 31, 12, 25, 1, 5, 30, 55,
9, 53, 15, 7, 31, 8, 19, 12, 21, 79, 28, 6, 55, 9, 14, 4,
1, 50, 26, 28, 16, 6, 53, 1, 13, 19, 5, 1, 29, 10, 4, 14,
8, 22, 14), REPWT71 = c(38, 14, 7, 20, 53, 2, 10, 23, 5,
27, 2, 35, 29, 3, 26, 16, 18, 2, 26, 10, 24, 5, 20, 17, 25,
18, 46, 4, 7, 26, 10, 29, 43, 6, 50, 27, 7, 52, 24, 19, 13,
2, 31, 4, 5, 30, 3, 71, 4, 2, 25, 28, 3, 5, 77, 11, 53, 3,
24, 4), REPWT72 = c(16, 50, 45, 42, 17, 5, 16, 53, 17, 18,
1, 43, 41, 1, 5, 27, 4, 0, 9, 3, 12, 1, 27, 30, 8, 10, 12,
14, 26, 19, 51, 16, 15, 29, 52, 10, 9, 10, 8, 31, 11, 2,
13, 16, 16, 30, 5, 66, 1, 7, 21, 16, 1, 30, 38, 15, 67, 21,
6, 25), REPWT73 = c(12, 15, 52, 18, 19, 4, 17, 41, 29, 14,
0, 26, 19, 1, 6, 5, 3, 1, 28, 9, 4, 1, 12, 28, 25, 9, 44,
3, 36, 34, 23, 22, 12, 24, 50, 15, 24, 10, 30, 22, 16, 3,
49, 14, 18, 10, 5, 76, 1, 13, 23, 34, 1, 15, 31, 4, 14, 10,
20, 26), REPWT74 = c(49, 86, 23, 10, 72, 0, 14, 33, 6, 30,
3, 8, 15, 2, 28, 6, 13, 1, 33, 3, 14, 3, 24, 4, 24, 16, 39,
4, 22, 19, 52, 35, 70, 5, 52, 5, 22, 28, 26, 15, 3, 2, 46,
3, 6, 47, 5, 15, 1, 9, 18, 33, 4, 27, 73, 17, 33, 11, 32,
29), REPWT75 = c(32, 85, 7, 22, 61, 0, 9, 40, 15, 21, 0,
33, 20, 2, 13, 28, 12, 2, 42, 4, 25, 3, 4, 3, 8, 9, 53, 27,
9, 28, 22, 32, 37, 17, 62, 33, 18, 31, 6, 4, 23, 3, 27, 15,
17, 23, 5, 54, 1, 8, 7, 16, 6, 29, 35, 28, 43, 3, 18, 31),
REPWT76 = c(30, 46, 66, 28, 90, 4, 2, 51, 5, 37, 3, 54, 16,
1, 6, 19, 19, 3, 22, 16, 16, 6, 13, 19, 35, 13, 31, 18, 20,
24, 18, 51, 58, 24, 41, 37, 16, 25, 32, 5, 19, 2, 17, 3,
6, 9, 2, 76, 1, 6, 5, 26, 4, 22, 54, 3, 13, 12, 33, 17),
REPWT77 = c(34, 50, 46, 8, 26, 2, 10, 28, 17, 5, 2, 31, 16,
3, 17, 16, 10, 2, 27, 16, 13, 6, 35, 21, 39, 3, 13, 15, 29,
21, 51, 21, 23, 7, 17, 40, 24, 36, 48, 36, 12, 2, 53, 12,
15, 24, 3, 74, 0, 2, 6, 4, 3, 23, 45, 4, 28, 4, 34, 18),
REPWT78 = c(58, 44, 21, 23, 51, 1, 14, 22, 29, 4, 1, 24,
5, 4, 21, 25, 13, 1, 46, 12, 26, 1, 24, 21, 43, 4, 34, 16,
9, 19, 22, 5, 26, 18, 68, 20, 34, 74, 7, 28, 10, 5, 8, 16,
15, 17, 4, 34, 4, 10, 23, 17, 4, 15, 42, 23, 12, 3, 6, 22
), REPWT79 = c(68, 20, 11, 50, 85, 4, 7, 26, 19, 16, 1, 45,
4, 2, 18, 19, 16, 2, 7, 15, 14, 4, 21, 17, 38, 8, 16, 11,
29, 5, 30, 23, 69, 8, 48, 22, 37, 11, 9, 6, 3, 3, 17, 12,
17, 13, 5, 33, 3, 7, 31, 17, 4, 15, 44, 11, 32, 22, 28, 27
), REPWT80 = c(42, 12, 62, 33, 93, 2, 18, 6, 7, 18, 0, 35,
6, 2, 18, 4, 10, 2, 29, 16, 3, 5, 18, 26, 31, 11, 49, 4,
10, 25, 32, 5, 25, 23, 57, 37, 5, 51, 46, 32, 11, 2, 28,
4, 4, 46, 1, 38, 3, 7, 35, 18, 6, 6, 13, 24, 14, 17, 18,
26)), row.names = c(NA, -60L), class = c("tbl_df", "tbl",
"data.frame"))

Ah, that sounds good. From the little I read at the IPUMS site, I thought the weights should come from there. It seemed unreasonable to have an individual user set them up in normal use.

Aha, as I was typing, the sample data arrived!

The ipums staff suggested I add two packages "ipumsr" and "survey". So from the code below ---

with the 'LIHTC_svy <- as survey' line I get: "Error in str2lang(x) : :2:0: unexpected end of input
1: ~
^"
And with 'LIHTC_svy <- filter' I get: "Error: object 'OverLIHTC' not found"

install.packages("tidyverse")
install.packages("srvyr")
install.packages("readxl")
install.packages("survey")
install.packages("ipumsr")

library(tidyverse)
library(srvyr)
library(readxl)
library(ipumsr)
library(survey)

hhRaw <- read_excel("D:/mhp3/qualnvhhs2.xlsx")

LIHTC_svy <- as_survey(hhRaw,
weight =HHWT ,
repweights =matches("REPWTP[0-9]+"),
type ="JK1",
scale =4/80,
rscales =rep(1,80),
mse =TRUE)

LIHTC_svy <- filter(OverLIHTC == 1) %>%
summarise(LIHTC=survey_total(vartype="ci")) %>%
mutate(LIHTC_Percent = LIHTC / survey_total()*100) %>%
select(LIHTC_Percent, LIHTC)

It's late enough here that I should not do anything tonight but I'll have look in the morning if someone with more knowledge of the area does not come up with a solution.

That is coming from

repweights =matches("REPWTP[0-9]+"),

and I have no idea whats going on. So far the documentation I have found is not that extensive!

That is because you are not dealing with a data.frame or a tibble.

 class(LIHTC_svy)
[1] "tbl_svy"        "survey.design2" "survey.design" 

I have no idea of the file structure but LIHTC_svy is a list.

OverLIHTC is in a tibble called variables which is the seventh element in LIHTC_svy

See

 LIHTC_svy$variables
# or

LIHTC_svy[[7]]

Oh, and I think OverLIHTC is all zeros.

IPUMS pointed out that the expression repweights =matches("REPWTP[0-9]+"), was in error. It should be REPWT not REPWTP.

To your comment about OverLIHTC being all zeros, it is actually a combination of zeros and ones... and the % I hope to test is the number of rows with ones divided by the number of all rows (combination of OverLIHTC with zeros and ones).

Ah!

So this runs!


suppressMessages(library(tidyverse))
library(srvyr)
library(readxl)
library(ipumsr)
library(survey)

dat1  <- read.csv("cbachx.csv")
hhRaw  <- dat1

LIHTC_svy  <- hhRaw |>  as_survey(
weight =HHWT ,
repweights = matches("REPWT[0-9]+"),
type ="JK1",
scale =4/80,
rscales =rep(1,80),
mse =TRUE)

Excellent.

Yes, and ran it with the original excel file, no detectable problems!!! Thanks for the help! Now... when I go to the next line of code I get the error message object 'OverLIHTC' not found. OverLIHTC is a variable with the critical data for determining the % I'm trying to get at, ideas?

LIHTC_svy <- filter(OverLIHTC == 1) %>%

  • summarise(LIHTC=survey_total(vartype="ci")) %>%
  • mutate(LIHTC_Percent = LIHTC / survey_total()*100) %>%
  • select(LIHTC_Percent, LIHTC)
    Error: object 'OverLIHTC' not found

That is because you are not dealing with a data.frame or a tibble.

 class(LIHTC_svy)
[1] "tbl_svy"        "survey.design2" "survey.design" 

I have no idea of the file structure but LIHTC_svy is a list.

Try this:

LIHTC_svy[[1]]
LIHTC_svy[[2]]
LIHTC_svy[[3]]
LIHTC_svy[[4]]
LIHTC_svy[[5]]
LIHTC_svy[[6]]
LIHTC_svy[[7]]
LIHTC_svy[[8]]
LIHTC_svy[[9]]
LIHTC_svy[[10]]
LIHTC_svy[[11]]

xx  <- LIHTC_svy[[7]]  ## returns a a tibble.  It may be what you nee

Ok, but where do those code lines fit within the overall structure? Do they come after this line:

LIHTC_svy <- hhRaw |> as_survey(
weight =HHWT ,
repweights = matches("REPWT[0-9]+"),
type ="JK1",
scale =4/80,
rscales =rep(1,80),
mse =TRUE)

LIHTC_svy[[1]]
LIHTC_svy[[2]]
LIHTC_svy[[3]]
LIHTC_svy[[4]]
LIHTC_svy[[5]]...

xx <- LIHTC_svy[[7]]