--- title: "Use cases" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Use cases} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: chunk_output_type: console --- The `surveytable` package can be used with different types of data. Here are some examples. # Unweighted data Unweighted data is stored in a `data.frame` or a similar object. One example of such a similar object is a tibble (`tbl`), which can be produced by the `tibble` package. `data.frame`s and similar objects do not contain information about survey design variables. Thus, `surveytable` treats these objects as unweighted data, with each observation having a weight of `1`. The example below illustrates how to use `surveytable` with unweighted data. We * create a tibble with unweighted data; * tell `surveytable` to work with this object; and * tabulate the `SPECCAT` (physician specialty) variable from these data. ``` r library(surveytable) library(tibble) mytbl = as_tibble(namcs2019sv_df) set_survey(mytbl) #> * mytbl: the survey is unweighted. ```
Survey info {mytbl (unweighted)} | ||
Variables | Observations | Design |
---|---|---|
Type of specialty (Primary, Medical, Surgical) {mytbl (unweighted)} | |||||||||
Level | n | Number | SE | LL | UL | Percent | SE | LL | UL |
---|---|---|---|---|---|---|---|---|---|
N = 8250. |
Survey info {mysurvey} | ||
Variables | Observations | Design |
---|---|---|
Type of specialty (Primary, Medical, Surgical) {mysurvey} | |||||||||
Level | n | Number | SE | LL | UL | Percent | SE | LL | UL |
---|---|---|---|---|---|---|---|---|---|
N = 8250. |
Survey info {mysurvey} | ||
Variables | Observations | Design |
---|---|---|
SPECCAT {mysurvey} | |||||||||
Level | n | Number | SE | LL | UL | Percent | SE | LL | UL |
---|---|---|---|---|---|---|---|---|---|
N = 8250. |
Survey info {mysurvey} | ||
Variables | Observations | Design |
---|---|---|
Type of specialty (Primary, Medical, Surgical) {mysurvey} | |||||||||
Level | n | Number | SE | LL | UL | Percent | SE | LL | UL |
---|---|---|---|---|---|---|---|---|---|
N = 8250. |