Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
astra-cdc committed Feb 5, 2024
1 parent 6bd01fa commit f5fada9
Show file tree
Hide file tree
Showing 34 changed files with 768 additions and 258 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# surveytable (development version)

* `codebook()`
* `set_survey()`:
* Improved output.
* Allows an unweighted survey as a `data.frame`.

# surveytable 0.9.2

* Addressed CRAN comments.
Expand Down
1 change: 0 additions & 1 deletion R/set_survey.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ set_survey = function(design, csv = getOption("surveytable.csv")) {
attr(design, "label") = paste(dl, "(unweighted)")
}


assert_that(inherits(design, c("survey.design", "svyrep.design"))
, msg = paste0(label_default, ": must be either a survey object"
, " (survey.design or svyrep.design) or a data.frame for an unweighted survey."
Expand Down
5 changes: 1 addition & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ Here is a basic example, to get you started.
library(surveytable)
```

```{r}
set_survey(namcs2019sv)
```

```{r, results='asis'}
set_survey(namcs2019sv)
tab("AGER")
```

Expand Down
52 changes: 41 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,53 @@ library(surveytable)
``` r
set_survey(namcs2019sv)
#> * To adjust how counts are rounded, see ?set_count_int
#> _
#> Survey name NAMCS 2019 PUF
#> Number of variables 33
#> Number of observations 8250
#> Info 1 Stratified 1 - level Cluster Sampling design (with
#> Info 2 replacement)
#> Info 3 With (398) clusters.
#> Info 4 survey::svydesign(ids = ~CPSUM, strata = ~CSTRATM,
#> Info 5 weights = ~PATWT,
#> Info 6 data = namcs2019sv_df)
```

<table class="huxtable" style="border-collapse: collapse; border: 0px; margin-bottom: 2em; margin-top: 2em; ; margin-left: auto; margin-right: auto; " id="tab:unnamed-chunk-3">
<caption style="caption-side: top; text-align: center;">
Survey info {NAMCS 2019 PUF}
</caption>
<col>
<col>
<col>
<col>
<tr>
<th style="vertical-align: top; text-align: left; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
Survey name
</th>
<th style="vertical-align: top; text-align: right; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
Number of variables
</th>
<th style="vertical-align: top; text-align: right; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
Number of observations
</th>
<th style="vertical-align: top; text-align: left; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
Design
</th>
</tr>
<tr>
<td style="vertical-align: top; text-align: left; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
NAMCS 2019 PUF
</td>
<td style="vertical-align: top; text-align: right; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
33
</td>
<td style="vertical-align: top; text-align: right; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
8,250
</td>
<td style="vertical-align: top; text-align: left; white-space: normal; border-style: solid solid solid solid; border-width: 0.4pt 0.4pt 0.4pt 0.4pt; padding: 6pt 6pt 6pt 6pt; font-weight: normal;">
Stratified 1 - level Cluster Sampling design (with replacement)<br>With
(398) clusters.<br>survey::svydesign(ids = \~CPSUM, strata = \~CSTRATM,
weights = \~PATWT, <br> data = namcs2019sv_df)
</td>
</tr>
</table>

``` r
tab("AGER")
```

<table class="huxtable" style="border-collapse: collapse; border: 0px; margin-bottom: 2em; margin-top: 2em; ; margin-left: auto; margin-right: auto; " id="tab:unnamed-chunk-4">
<table class="huxtable" style="border-collapse: collapse; border: 0px; margin-bottom: 2em; margin-top: 2em; ; margin-left: auto; margin-right: auto; " id="tab:unnamed-chunk-3">
<caption style="caption-side: top; text-align: center;">
Patient age recode {NAMCS 2019 PUF}
</caption>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5fada9

Please sign in to comment.