title: Error generating a chi-square test with data that was converted from wide to long
body: <p>I am using Demographic and Health Survey data. My end goal is to run multivariate logistic regressions. Since I am using complex data, I converted the data from wide to long. I continued with analyses and ran a chi-square test. I successfully ran this using two variables. Because I want to run an analyses using four variables that describe the same undernutrition indicator for four children and cross it with the urban and rural variable, I ran another chi-square, considering my data is correctly converted from wide to long to do this. Unfortunately, I got an error this time. Please be aware I am running analyses adjusting for survey design. Below codes and data output. Can you support me with the correct coding to run an appropiate conversion from wide to long and a code to run a chi-square test appropiately?</p>
  <pre><code>`library(haven)`
  
  `HNIR62FL_data_2 &lt;- readta that has been converted from wide to long?_sav(&quot;~/DHS/HNIR62SV/HNIR62FL_data_2.SAV&quot;)`
  
  `View(HNIR62FL_data_2)`
  
  `obsHNIR62FL_data_2 &lt;- subset(HNIR62FL_data_2, !is.na(V021) &amp; !is.na(V022) &amp; !is.na(D005))`
  
  `myvars &lt;- c(&quot;CASEID&quot;, &quot;V013&quot;, &quot;V021&quot;, &quot;V022&quot;, &quot;V025&quot;, &quot;V106&quot;, &quot;V137&quot;, &quot;V190&quot;, &quot;V714&quot;, &quot;D005&quot;, &quot;D104&quot;, &quot;D106&quot;, &quot;D107&quot;, &quot;D108&quot;,&quot;v1014&quot;, &quot;v1016&quot;, &quot;v1021&quot;, &quot;v1023&quot;, &quot;v1038&quot;, &quot;v1039&quot;, &quot;v1045&quot;, &quot;v1113&quot;, &quot;V701&quot;, &quot;v1007_1&quot;, &quot;v1007_2&quot;, &quot;v1007_3&quot;, &quot;v1007_4&quot;, &quot;v1008_1&quot;, &quot;v1008_2&quot;, &quot;v1008_3&quot;, &quot;v1008_4&quot;, &quot;v1009_1&quot;, &quot;v1009_2&quot;, &quot;v1009_3&quot;, &quot;v1009_4&quot;, &quot;v1010_1&quot;, &quot;v1010_2&quot;, &quot;v1010_3&quot;, &quot;v1010_4&quot;, &quot;v1020_1&quot;, &quot;v1020_2&quot;, &quot;v1020_3&quot;, &quot;v1020_4&quot;, &quot;v1071_1&quot;, &quot;v1071_2&quot;, &quot;v1071_3&quot;, &quot;v1071_4&quot;, &quot;v1088_1&quot;, &quot;v1088_2&quot;, &quot;v1088_3&quot;, &quot;v1088_4&quot;, &quot;v1096_1&quot;, &quot;v1096_2&quot;, &quot;v1096_3&quot;, &quot;v1096_4&quot;, &quot;v1104_1&quot;, &quot;v1104_2&quot;, &quot;v1104_3&quot;, &quot;v1104_4&quot;, &quot;v1111_1&quot;, &quot;v1111_2&quot;, &quot;v1111_3&quot;, &quot;v1111_4&quot;, &quot;v1112_1&quot;, &quot;v1112_2&quot;, &quot;v1112_3&quot;, &quot;v1112_4&quot;)`
  
  `newobsHNIR62FL_data_2 &lt;- obsHNIR62FL_data_2[myvars]`
  
  `dhsdesign &lt;- svydesign(newobsHNIR62FL_data_2$V021, strata = newobsHNIR62FL_data_2$V022, weights = newobsHNIR62FL_data_2$D005/1000000, data = newobsHNIR62FL_data_2)`
  
  `newobsHNIR62FL_data_2 %&gt;%  mutate(across(starts_with(c(&quot;V&quot;, &quot;v&quot;)), as.double)) %&gt;% pivot_longer(cols=starts_with(c(&quot;V&quot;, &quot;v&quot;)), names_to = c(&quot;name&quot;, &quot;id&quot;), values_to = &quot;value&quot;, names_sep = &quot;_&quot;)`
  
  `A tibble: 379,237 x 9
     CASEID           D005     D104     D106    D107    D108 name  id    value
     &lt;chr&gt;           &lt;dbl&gt; &lt;dbl+lb&gt; &lt;dbl+lb&gt; &lt;dbl+l&gt; &lt;dbl+l&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
   1 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V013  NA        2
   2 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V021  NA      564
   3 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V022  NA       16
   4 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V025  NA        1
   5 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V106  NA        1
   6 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V137  NA        2
   7 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V190  NA        3
   8 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] V714  NA        0
   9 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] v1014 NA        2
  10 &quot;      564 9~ 1758042   0 [No]   0 [No]  0 [No]  0 [No] v1016 NA        1
  # ... with 379,227 more rows`
  
  ```
  Warning message:
  Expected 2 pieces. Missing pieces filled with `NA` in 17 rows [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17].
  ```
  
  
  
  `summary(svytable(~v1113+v1039, dhsdesign))`
  
  ```
  v1039
  v1113    1    2    3    4
      0 1087  934  626  646
      1  462  518  388  359
  
      Pearson's X^2: Rao &amp; Scott adjustment
  
  data:  svychisq(~v1113 + v1039, design = dhsdesign, statistic = &quot;F&quot;)
  F = 5.4626, ndf = 2.9836, ddf = 3243.1635, p-value = 0.0009852`
  ```
  
  `summary(svytable(~v1007_1 + v1007_2+ v1007_3 + v1007_4 + V025, dhsdesign))`
  
  ```
  Error in svychisq.survey.design(~v1007_1 + v1007_2 + v1007_3 + v1007_4 +  : 
    Only 2-way tables at the moment
  ```
  
  `dput(head(newobsHNIR62FL_data_2))`
  
  ```
  `structure(list(CASEID = structure(c(&quot;      564 91  2&quot;, &quot;      198 61  2&quot;, 
  &quot;      267 21  1&quot;, &quot;     1089 81  2&quot;, &quot;      583 61  8&quot;, &quot;      989101  2&quot;
  ), label = &quot;Case Identification&quot;, format.spss = &quot;A15&quot;, display_width = 17L), 
      V013 = structure(c(2, 4, 4, 4, 6, 3), label = &quot;Age in 5-year groups&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(`15-19` = 1, 
      `20-24` = 2, `25-29` = 3, `30-34` = 4, `35-39` = 5, `40-44` = 6, 
      `45-49` = 7), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), V021 = structure(c(564, 198, 267, 1089, 583, 989), label = &quot;Primary sampling unit&quot;, format.spss = &quot;F4.0&quot;, display_width = 6L), 
      V022 = structure(c(16, 8, 9, 37, 17, 33), label = &quot;Sample strata for sampling errors&quot;, format.spss = &quot;F4.0&quot;, display_width = 6L, labels = c(`Atlántida Urbano` = 1, 
      `Atlántida Rural` = 2, `Colón Urbano` = 3, `Colón Rural` = 4, 
      `Comayagua Urbano` = 5, `Comayagua Rural` = 6, `Copán Urbano` = 7, 
      `Copán Rural` = 8, `San Pedro Sula Urbano` = 9, `Cortés Resto Urbano` = 10, 
      `Cortés Resto Rural` = 11, `Choluteca Urbano` = 12, `Choluteca Rural` = 13, 
      `El Paraíso Urbano` = 14, `El Paraíso Rural` = 15, `Tegucigalpa Urbano` = 16, 
      `Morazán Resto Urbano` = 17, `Morazán Resto Rural` = 18, 
      `Gracias a Dios Urbano` = 19, `Gracias a Dios Rural` = 20, 
      `Intibucá Urbano` = 21, `Intibucá Rural` = 22, `Islas de Bahía Urbano` = 23, 
      `Islas de Bahía Rural` = 24, `La Paz Urbano` = 25, `La Paz Rural` = 26, 
      `Lempira Urbano` = 27, `Lempira Rural` = 28, `Ocotepeque Urbano` = 29, 
      `Ocotepeque Rural` = 30, `Olancho Urbano` = 31, `Olancho Rural` = 32, 
      `Santa Bárbara Urbano` = 33, `Santa Bárbara Rural` = 34, 
      `Valle Urbano` = 35, `Valle Rural` = 36, `Yoro Urbano` = 37, 
      `Yoro Rural` = 38), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), V025 = structure(c(1, 2, 1, 1, 1, 1), label = &quot;Type of place of residence&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(Urban = 1, 
      Rural = 2), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), V106 = structure(c(1, 0, 1, 1, 1, 2), label = &quot;Highest educational level&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(`No education` = 0, 
      Primary = 1, Secondary = 2, Higher = 3), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), V137 = structure(c(2, 2, 2, 1, 
      0, 1), label = &quot;Number of children 5 and under in household (de jure)&quot;, format.spss = &quot;F2.0&quot;, display_width = 6L), 
      V190 = structure(c(3, 1, 2, 4, 2, 4), label = &quot;Wealth index&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(Poorest = 1, 
      Poorer = 2, Middle = 3, Richer = 4, Richest = 5), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), V714 = structure(c(0, 0, 1, 1, 
      0, 0), label = &quot;Respondent currently working&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(No = 0, 
      Yes = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), D005 = structure(c(1758042, 927099, 1296895, 1087346, 
      1005935, 1112882), label = &quot;Weight for Domestic Violence (6 decimals)&quot;, format.spss = &quot;F8.0&quot;, display_width = 10L), 
      D104 = structure(c(0, 0, 0, 0, 0, 0), label = &quot;Experienced any emotional violence&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(No = 0, 
      Yes = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), D106 = structure(c(0, 0, 0, 0, 0, 0), label = &quot;Experienced any less severe violence (D105A-C,J) by husband/partner&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(No = 0, 
      `Yes (D105A-D)` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), D107 = structure(c(0, 0, 0, 0, 0, 0), label = &quot;Experienced any severe violence (D105D-F) by husband/partner&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(No = 0, 
      `Yes (D105E-G)` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), D108 = structure(c(0, 0, 0, 0, 0, 0), label = &quot;Experienced any sexual violence (D105H-I,K) by husband/partner&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(No = 0, 
      `Yes (D105H-I)` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1014 = structure(c(2, 2, 2, 4, 2, 4), label = &quot;women BMI category&quot;, format.spss = &quot;F8.0&quot;, labels = c(underweight = 1, 
      `normal weight` = 2, overweight = 3, obese = 4), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1016 = structure(c(1, 0, 0, 1, 
      0, 1), label = &quot;women height category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`woman height &lt;150 cm` = 0, 
      `woman height 150 cm or more ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1021 = structure(c(4, 3, 1, 1, 
      4, 3), label = &quot;region category&quot;, format.spss = &quot;F8.0&quot;, labels = c(Northern = 1, 
      Southern = 2, Western = 3, Central = 4, Eastern = 5), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1023 = structure(c(2, 5, 3, 2, 
      4, 1), label = &quot;parity&quot;, format.spss = &quot;F8.0&quot;, labels = c(`0` = 0, 
      `1` = 1, `2` = 2, `3` = 3, `4` = 4, `5 or more` = 5), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1038 = structure(c(2, 1, 3, 2, 
      2, 2), label = &quot;marital status&quot;, format.spss = &quot;F8.0&quot;, labels = c(`Never in union` = 0, 
      Married = 1, `Living with partner ` = 2, `Divorced, widowed or separated/no longer living together` = 3
      ), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;)), 
      v1039 = structure(c(2, 4, 3, 2, 3, 1), label = &quot;marital duration&quot;, format.spss = &quot;F8.0&quot;, labels = c(`Never in a union` = 0, 
      `0-4 years` = 1, `5-9 years` = 2, `10-14 years` = 3, `15 years or more` = 4
      ), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;)), 
      v1045 = structure(c(4, 4, NA, 3, 1, 4), label = &quot;Women decision making scale&quot;, format.spss = &quot;F8.0&quot;, labels = c(`No decision making skills` = 0, 
      `Respondent alone/respondent and husband/partner decide on one issue` = 1, 
      `Respondent alone/respondent and husband/partner decide on two issues` = 2, 
      `Respondent alone/respondent and husband/partner decide on three issues` = 3, 
      `Respondent alone/respondent and husband/partner decide on four issues` = 4
      ), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;)), 
      v1113 = structure(c(0, 0, 0, 0, 0, 0), label = &quot;Any intimate partner violence&quot;, format.spss = &quot;F8.0&quot;, labels = c(`Has not experienced any form of intimate partner violence` = 0, 
      `Has experienced any form of intimate partner violence` = 1
      ), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;)), 
      V701 = structure(c(2, 1, 1, 2, 2, 2), label = &quot;Husband/partner's education level&quot;, format.spss = &quot;F1.0&quot;, display_width = 6L, labels = c(`No education` = 0, 
      Primary = 1, Secondary = 2, Higher = 3, `Don't know` = 8), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1007_1 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;youngest child stunting category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted child ` = 0, 
      `not stunted child` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1007_2 = structure(c(1, 0, 0, NA, NA, NA), label = &quot;stunting category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(stunted = 0, 
      `not stunted` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1007_3 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;stunting category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(stunted = 0, 
      `not stunted` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1007_4 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;stunting category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(stunted = 0, 
      `not stunted` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1008_1 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;youngest child underweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`underweight child` = 0, 
      `not underweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1008_2 = structure(c(1, 1, 0, 
      NA, NA, NA), label = &quot;underweight category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(underweight = 0, 
      `not underweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1008_3 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;underweight category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(underweight = 0, 
      `not underweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1008_4 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;underweight category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(underweight = 0, 
      `not underweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1009_1 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;youngest child wasting category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`wasted child` = 0, 
      `not wasted child ` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1009_2 = structure(c(1, 1, 1, NA, NA, NA), label = &quot;wasting category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(wasted = 0, 
      `not wasted` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1009_3 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;wasting category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(wasted = 0, 
      `not wasted ` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1009_4 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;wasting category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(wasted = 0, 
      `not wasted` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1010_1 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;youngest child overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`overweight child` = 0, 
      `not overweight child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1010_2 = structure(c(1, 1, 1, 
      NA, NA, NA), label = &quot;overweight category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(overweight = 0, 
      `not overweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1010_3 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;overweight category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(overweight = 0, 
      `not overweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1010_4 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;overweight category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(overweight = 0, 
      `not overweight` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1020_1 = structure(c(1, 0, 1, 0, 1, 0), label = &quot;youngest child morbidity category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`youngest child with no morbidity` = 0, 
      `youngest child with morbidity ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1020_2 = structure(c(1, 0, 1, 
      NA, NA, NA), label = &quot;Morbidity category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`youngest child with no morbidity` = 0, 
      `youngest child with morbidity` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1020_3 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;Morbidity category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`youngest child with no morbidity` = 0, 
      `youngest child with morbidity` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1020_4 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;Morbidity category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`youngest child with no morbidity` = 0, 
      `youngest child with morbidity` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1071_1 = structure(c(0, NA, 1, 
      1, 1, 1), label = &quot;anemia category (youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(anemic = 0, 
      `not anemic` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1071_2 = structure(c(1, 1, 0, NA, NA, NA), label = &quot;anemia category (second to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(anemic = 0, 
      `not anemic` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1071_3 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;anemia category (third to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(anemic = 0, 
      `not anemic` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1071_4 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;anemia category (fourth to youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(anemic = 0, 
      `not anemic` = 1), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, 
      &quot;double&quot;)), v1088_1 = structure(c(NA_real_, NA_real_, NA_real_, 
      NA_real_, NA_real_, NA_real_), label = &quot;youngest child stunting + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted and overweight child` = 0, 
      `not stunted and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1088_2 = structure(c(1, 1, NA, 
      NA, NA, NA), label = &quot;second to youngest child stunting + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted and overweight child` = 0, 
      `not stunted and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1088_3 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;third to youngest child stunting + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted and overweight child ` = 0, 
      `not stunted and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1088_4 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;fourth to youngest child stunting + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted and overweight child ` = 0, 
      `not stunted and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1096_1 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;youngest child anemic + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and overweight child ` = 0, 
      `not anemic and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1096_2 = structure(c(1, 1, 1, 
      NA, NA, NA), label = &quot;second to youngest child anemic + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and overweight child ` = 0, 
      `not anemic and overweight child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1096_3 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;third to youngest child anemic + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and overweight child ` = 0, 
      `not anemic and overweight child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1096_4 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;fourth to youngest child anemic + overweight category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and overweight child ` = 0, 
      `not anemic and overweight child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1104_1 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;youngest child anemic + stunted category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and stunted child` = 0, 
      `not anemic and not stunted child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1104_2 = structure(c(1, 1, NA, 
      NA, NA, NA), label = &quot;second to youngest child anemic + stunted category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and stunted child ` = 0, 
      `not anemic and stunted child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1104_3 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;third to youngest child anemic + stunted category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`anemic and stunted child ` = 0, 
      `not anemic and stunted child ` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1104_4 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;fourth to youngest child anemic + stunted category&quot;, format.spss = &quot;F8.0&quot;, labels = c(`stunted and anemic child` = 0, 
      `not stunted and anemic child` = 1), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1111_1 = structure(c(3, 1, 4, 
      4, 5, 6), label = &quot;Child age (youngest child)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`0-5 months` = 1, 
      `6-11 months` = 2, `12-23 months` = 3, `24-35 months` = 4, 
      `36-47 months` = 5, `48-59 months` = 6), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1111_2 = structure(c(6, 5, 6, 
      NA, NA, NA), label = &quot;Child age (second to youngest)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`0-5 months` = 1, 
      `6-11 months` = 2, `12-23 months` = 3, `24-35 months` = 4, 
      `36-47 months` = 5, `48-59 months` = 6), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1111_3 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;Child age (third to youngest)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`0-5 months` = 1, 
      `6-11 months` = 2, `12-23 months` = 3, `24-35 months` = 4, 
      `36-47 months` = 5, `48-59 months` = 6), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1111_4 = structure(c(NA_real_, 
      NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), label = &quot;Child age (fourth to youngest)&quot;, format.spss = &quot;F8.0&quot;, labels = c(`0-5 months` = 1, 
      `6-11 months` = 2, `12-23 months` = 3, `24-35 months` = 4, 
      `36-47 months` = 5, `48-59 months` = 6), class = c(&quot;haven_labelled&quot;, 
      &quot;vctrs_vctr&quot;, &quot;double&quot;)), v1112_1 = structure(c(2, 2, 1, 
      1, 1, 1), label = &quot;Sex of child&quot;, format.spss = &quot;F1.0&quot;, display_width = 7L, labels = c(Male = 1, 
      Female = 2), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), v1112_2 = structure(c(1, 2, 1, 2, 1, NA), label = &quot;Sex of child&quot;, format.spss = &quot;F1.0&quot;, display_width = 7L, labels = c(Male = 1, 
      Female = 2), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), v1112_3 = structure(c(NA, 2, 1, NA, 2, NA), label = &quot;Sex of child&quot;, format.spss = &quot;F1.0&quot;, display_width = 7L, labels = c(Male = 1, 
      Female = 2), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      )), v1112_4 = structure(c(NA, 2, NA, NA, 1, NA), label = &quot;Sex of child&quot;, format.spss = &quot;F1.0&quot;, display_width = 7L, labels = c(Male = 1, 
      Female = 2), class = c(&quot;haven_labelled&quot;, &quot;vctrs_vctr&quot;, &quot;double&quot;
      ))), row.names = c(NA, -6L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;
  ))`
  ```
  </code></pre>