All the variables other than "termx" are "0", "1". "1" represents "Yes" or "Exposed" I would want to generate a table with prevalence /10,000 (Wilson's 95% CI) by the variable "termx"
str(b.pcalc)
tibble [141,648 x 5] (S3: tbl_df/tbl/data.frame)
$ pcalc_anenc : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ pcalc_ence : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ pcalc_spin : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ pcalc_micr : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ termx : Factor w/ 7 levels "39-40 weeks",..: 5 5 1 5 4 5 5 5 5 5 ...
..- attr(*, "label")= chr "Pregnancy Terms"
I would like the table to look like this:
| Birth defects | <28 weeks | 28 to <32 weeks | 32 to <37 weeks | 37-38 weeks | 39-40 weeks | 41-<42 weeks | 42+ weeks |
| ------------- | --------- | --------------- | --------------- | ----------- | ----------- | ------------ | --------- |
| pcalc_anenc | 15.5 (2.7,87.0) | 19.7 (7.7,50.6) | 3.2 (1.4,7.5) | 0.2 (0.0,1.1) | 0.2 (0.0,1.1) | 0.0 (0.0,3.0) | 2.7 (0.7,10.0) |
| pcalc_ence | 0.0 (0.0,59.0) | 4.9 (0.9,27.9) | 2.6 (1.0,6.6) | 1.7 (0.9,3.2) | 0.2 (0.0,1.1) | 0.0 (0.0,3.0) | 0.0 (0.0,5.2) |
| pcalc_spin | 15.5 (2.7,87.0) | 4.9 (0.9,27.9) | 9.0 (5.4,15.1) | 4.9 (3.4,7.2) | 3.2 (1.9,5.1) | 1.6 (0.4,5.8) | 2.7 (0.7,10.0) |
