From 771d3af53fbce75f3d42bba6a1c61c50c80c7958 Mon Sep 17 00:00:00 2001 From: Alex Strashny Date: Mon, 11 Mar 2024 11:33:52 -0400 Subject: [PATCH] Number of observations" --- DESCRIPTION | 1 - NEWS.md | 1 + R/codebook.R | 2 +- R/print.surveytable_table.R | 3 +- R/set_count.R | 4 +- R/set_survey.R | 12 +- R/tab.R | 126 ++- R/tab_rate.R | 9 +- R/tab_subset_rate.R | 9 +- R/total.R | 36 +- R/total_rate.R | 12 +- R/var_cross.R | 4 +- R/z_present.R | 30 +- R/zzz.R | 4 +- README.md | 26 +- ...tory-Medical-Care-Survey-NAMCS-tables.html | 955 +++++++++++++++--- docs/articles/surveytable.html | 722 +++++++++++-- docs/index.html | 26 +- docs/pkgdown.yml | 2 +- docs/reference/print.surveytable_table.html | 123 +-- docs/reference/set_count_1k.html | 29 +- docs/reference/set_output.html | 39 +- docs/reference/set_survey.html | 4 +- docs/reference/show_options.html | 8 +- docs/reference/survey_subset.html | 21 +- docs/reference/svyciprop_adjusted.html | 39 +- docs/reference/tab.html | 162 +-- docs/reference/tab_rate.html | 45 +- docs/reference/tab_subset.html | 181 ++-- docs/reference/tab_subset_rate.html | 70 +- docs/reference/total.html | 14 +- docs/reference/total_rate.html | 14 +- docs/reference/var_all.html | 20 +- docs/reference/var_any.html | 20 +- docs/reference/var_case.html | 40 +- docs/reference/var_collapse.html | 54 +- docs/reference/var_copy.html | 68 +- docs/reference/var_cross.html | 91 +- docs/reference/var_cut.html | 31 +- docs/search.json | 2 +- man/set_survey.Rd | 4 +- ...atory-Medical-Care-Survey-NAMCS-tables.Rmd | 6 +- 42 files changed, 2230 insertions(+), 839 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0371823..78423f7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,6 @@ LazyData: true LazyDataCompression: bzip2 Imports: assertthat, - forcats, huxtable, magrittr, survey diff --git a/NEWS.md b/NEWS.md index a4037af..4c61902 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ * Improved output. * Allows an unweighted survey as a `data.frame`. * Can set certain options using an argument. +* Tabulation functions show the number of observations. # surveytable 0.9.2 diff --git a/R/codebook.R b/R/codebook.R index 9c89be1..ba19dba 100644 --- a/R/codebook.R +++ b/R/codebook.R @@ -84,7 +84,7 @@ codebook = function(all = FALSE lret[[2]] = .write_out(ret, csv = csv) if (all) { - op_ = options(surveytable.check_present = FALSE) + op_ = options(surveytable.find_lpe = FALSE) on.exit(options(op_)) for (ii in 1:ncol(design$variables)) { n1 = nn[ii] diff --git a/R/print.surveytable_table.R b/R/print.surveytable_table.R index d8d550b..06c7ec0 100644 --- a/R/print.surveytable_table.R +++ b/R/print.surveytable_table.R @@ -19,7 +19,8 @@ print.surveytable_table = function(x, ...) { hh = df1 %>% hux %>% set_all_borders if (!is.null(txt <- attr(df1, "title"))) { - caption(hh) = paste(strwrap(txt), collapse = "\n") + # caption(hh) = paste(strwrap(txt), collapse = "\n") + caption(hh) = txt } if (!is.null(nc <- attr(df1, "num"))) { diff --git a/R/set_count.R b/R/set_count.R index 228a97b..94b79e3 100644 --- a/R/set_count.R +++ b/R/set_count.R @@ -20,7 +20,7 @@ set_count_1k = function() { # If making changes, update .onLoad() and set_survey() options( surveytable.tx_count = ".tx_count_1k" - , surveytable.names_count = c("Number (000)", "SE (000)", "LL (000)", "UL (000)") + , surveytable.names_count = c("n", "Number (000)", "SE (000)", "LL (000)", "UL (000)") ) message(paste0("* Rounding counts to the nearest 1,000." , "\n* ?set_count_1k for other options.")) @@ -31,7 +31,7 @@ set_count_1k = function() { set_count_int = function() { options( surveytable.tx_count = ".tx_count_int" - , surveytable.names_count = c("Number", "SE", "LL", "UL") + , surveytable.names_count = c("n", "Number", "SE", "LL", "UL") ) message(paste0("* Rounding counts to the nearest integer." , "\n* ?set_count_int for other options.")) diff --git a/R/set_survey.R b/R/set_survey.R index bfac866..8c8b0d7 100644 --- a/R/set_survey.R +++ b/R/set_survey.R @@ -6,11 +6,11 @@ #' `opts`: #' * `"nchs"`: #' * Round counts to the nearest 1,000 -- see [set_count_1k()]. -#' * Identify low-precision estimates (`surveytable.check_present` option). +#' * Identify low-precision estimates (`surveytable.find_lpe` option). #' * Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation (`surveytable.adjust_svyciprop` option). #' * `"general":` #' * Round counts to the nearest integer -- see [set_count_int()]. -#' * Do not look for low-precision estimates (`surveytable.check_present` option). +#' * Do not look for low-precision estimates (`surveytable.find_lpe` option). #' * Percentage CI's: use standard Korn-Graubard CI's. #' #' Optionally, the survey can have an attribute called `label`, which is the @@ -41,15 +41,15 @@ set_survey = function(design, opts = "NCHS" if (opts == "nchs") { options( surveytable.tx_count = ".tx_count_1k" - , surveytable.names_count = c("Number (000)", "SE (000)", "LL (000)", "UL (000)") - , surveytable.check_present = TRUE + , surveytable.names_count = c("n", "Number (000)", "SE (000)", "LL (000)", "UL (000)") + , surveytable.find_lpe = TRUE , surveytable.adjust_svyciprop = TRUE ) } else if (opts == "general") { options( surveytable.tx_count = ".tx_count_int" - , surveytable.names_count = c("Number", "SE", "LL", "UL") - , surveytable.check_present = FALSE + , surveytable.names_count = c("n", "Number", "SE", "LL", "UL") + , surveytable.find_lpe = FALSE , surveytable.adjust_svyciprop = FALSE ) } else { diff --git a/R/tab.R b/R/tab.R index 9fd53c4..e95ec9d 100644 --- a/R/tab.R +++ b/R/tab.R @@ -114,7 +114,6 @@ tab = function(... if (nlv < 2) { assert_that(all(design$variables[,vr] == design$variables[1,vr])) mp = .total(design) - assert_that(ncol(mp) %in% c(4L, 5L)) fa = attr(mp, "footer") mp = cbind( data.frame(Level = design$variables[1,vr]) @@ -122,7 +121,7 @@ tab = function(... if (!is.null(fa)) { attr(mp, "footer") = fa } - attr(mp, "num") = 2:5 + attr(mp, "num") = 2:6 attr(mp, "title") = .getvarname(design, vr) return(.write_out(mp, csv = csv)) } else if (nlv > max_levels) { @@ -142,10 +141,13 @@ tab = function(... ## counts = svyby(frm, frm, design, unwtd.count)$counts assert_that(length(counts) == nlv) - if (getOption("surveytable.check_present")) { + if (getOption("surveytable.find_lpe")) { + assert_that(is.vector(counts), all(counts >= 1), is.numeric(counts) + , all(counts == trunc(counts))) pro = getOption("surveytable.present_restricted") %>% do.call(list(counts)) - } else { - pro = list(flags = rep("", length(counts)), has.flag = c()) + assert_that(is.list(pro) + , setequal(names(pro), c("id", "descriptions", "flags", "has.flag")) + , all(pro$has.flag %in% names(pro$descriptions))) } ## @@ -153,6 +155,7 @@ tab = function(... mmcr = data.frame(x = as.numeric(sto) , s = sqrt(diag(attr(sto, "var"))) ) mmcr$counts = counts + counts_sum = sum(counts) # deff = attr(sto, "deff") %>% diag # I am having trouble interpreting this deff. @@ -175,14 +178,18 @@ tab = function(... mmcr$ll = exp(mmcr$lnx - mmcr$k) mmcr$ul = exp(mmcr$lnx + mmcr$k) - if (getOption("surveytable.check_present")) { + if (getOption("surveytable.find_lpe")) { + assert_that(is.data.frame(mmcr), nrow(mmcr) >= 1 + , all(c("x", "s", "ll", "ul", "samp.size", "counts", "degf") %in% names(mmcr))) pco = getOption("surveytable.present_count") %>% do.call(list(mmcr)) - } else { - pco = list(flags = rep("", nrow(mmcr)), has.flag = c()) + assert_that(is.list(pco) + , setequal(names(pco), c("id", "descriptions", "flags", "has.flag")) + , all(pco$has.flag %in% names(pco$descriptions))) } - mmcr = mmcr[,c("x", "s", "ll", "ul")] - mmc = getOption("surveytable.tx_count") %>% do.call(list(mmcr)) + mmc = getOption("surveytable.tx_count") %>% do.call(list(mmcr[,c("x", "s", "ll", "ul")])) + mmc$counts = mmcr$counts + mmc = mmc[,c("counts", "x", "s", "ll", "ul")] names(mmc) = getOption("surveytable.names_count") ## @@ -214,11 +221,13 @@ tab = function(... } ret$degf = df1 - if (getOption("surveytable.check_present")) { + if (getOption("surveytable.find_lpe")) { + assert_that(is.data.frame(ret), nrow(ret) >= 1 + , all(c("Proportion", "SE", "LL", "UL", "n numerator", "n denominator") %in% names(ret))) ppo = getOption("surveytable.present_prop") %>% do.call(list(ret)) - } else { - nlvs = design$variables[, vr] %>% nlevels - ppo = list(flags = rep("", nlvs), has.flag = c()) + assert_that(is.list(ppo) + , setequal(names(ppo), c("id", "descriptions", "flags", "has.flag")) + , all(ppo$has.flag %in% names(ppo$descriptions))) } mp2 = getOption("surveytable.tx_prct") %>% do.call(list(ret[,c("Proportion", "SE", "LL", "UL")])) @@ -226,48 +235,69 @@ tab = function(... ## assert_that(nrow(mmc) == nrow(mp2) - , nrow(mmc) == nrow(mmcr) - , nrow(mmc) == length(pro$flags) - , nrow(mmc) == length(pco$flags) - , nrow(mmc) == length(ppo$flags) ) - + , nrow(mmc) == nrow(mmcr)) mp = cbind(mmc, mp2) - flags = paste(pro$flags, pco$flags, ppo$flags) %>% trimws - if (any(nzchar(flags))) { - mp$Flags = flags - } ## rownames(mp) = NULL mp = cbind(data.frame(Level = lvs), mp) - attr(mp, "num") = 2:5 - attr(mp, "title") = .getvarname(design, vr) - mp %<>% .add_flags( c(pro$has.flag, pco$has.flag, ppo$has.flag) ) + attr(mp, "num") = 2:6 + attr(mp, "title") = .getvarname(design, vr) + attr(mp, "footer") = paste0("N = ", counts_sum, ".") + + if (getOption("surveytable.find_lpe")) { + assert_that(nrow(mmc) == length(pro$flags) + , nrow(mmc) == length(pco$flags) + , nrow(mmc) == length(ppo$flags)) + flags = paste(pro$flags, pco$flags, ppo$flags) %>% trimws + if (any(nzchar(flags))) { + mp$Flags = flags + } + mp %<>% .add_flags( list(pro, pco, ppo) ) + } + .write_out(mp, csv = csv) } -.add_flags = function(df1, has.flag) { - if (!getOption("surveytable.check_present")) { - attr(df1, "footer") = NULL - } else if (is.null(has.flag)) { - attr(df1, "footer") = "(Checked presentation standards. Nothing to report.)" - } else { - v1 = c() - for (ff in has.flag) { - v1 %<>% c(switch(ff - , R = "R: If the data is confidential, suppress *all* estimates, SE's, CI's, etc." - , Cx = "Cx: suppress count (and rate)" - , Cr = "Cr: footnote count - RSE" # .present_count_3030 - , Cdf = "Cdf: review count (and rate) - degrees of freedom" - , Px = "Px: suppress percent" - , Pc = "Pc: footnote percent - complement" - , Pdf = "Pdf: review percent - degrees of freedom" - , P0 = "P0: review percent - 0% or 100%" - , paste0(ff, ": unknown flag!") - )) - } - attr(df1, "footer") = v1 %>% paste(collapse="; ") - } +.add_flags = function(df1, lfo) { + if (!getOption("surveytable.find_lpe")) { + return(df1) + } + + retR = list() + retNR = c() + for (fo in lfo) { + if (!is.null(fo$has.flag)) { + v1 = paste0(fo$descriptions[ fo$has.flag ], collapse = "; ") + if (is.null(retR[[ fo$id ]])) { + retR[[ fo$id ]] = v1 + } else { + retR[[ fo$id ]] %<>% paste(v1, sep = "; ") + } + } + retNR %<>% c(fo$id) + } + retNR %<>% unique + retNR = retNR[which( !(retNR %in% names(retR)))] + assert_that(!(is.null(retR) && length(retNR) == 0)) + + ret = "" + if (!is.null(retR)) { + for (nn in names(retR)) { + v1 = paste0("Checked ", nn, ": ", retR[[nn]], ".") + ret %<>% paste(v1) + } + } + if (length(retNR) > 0) { + v1 = paste0("Checked ", paste(retNR, collapse = ", "), ". Nothing to report.") + ret %<>% paste(v1) + } + + if (is.null(v1 <- attr(df1, "footer"))) { + attr(df1, "footer") = ret + } else { + attr(df1, "footer") = paste0(v1, ret) + } df1 } diff --git a/R/tab_rate.R b/R/tab_rate.R index 4f1d645..f7c9f34 100644 --- a/R/tab_rate.R +++ b/R/tab_rate.R @@ -55,7 +55,7 @@ tab_rate = function(vr, pop , class(design$variables[,vr])[1] )) op_ = options(surveytable.tx_count = ".tx_count_none" - , surveytable.names_count = c("Number", "SE_count" + , surveytable.names_count = c("n", "Number", "SE_count" , "LL_count", "UL_count")) on.exit(options(op_)) tfo = .tab_factor(design = design @@ -79,19 +79,20 @@ tab_rate = function(vr, pop } assert_that(isTRUE(all(m1$Population > 0 | is.na(m1$Population) )) , msg = paste("Population values for each level of", vr, "must be positive.")) + m1[,c("Rate", "SE", "LL", "UL")] = NULL m1[,c("Rate", "SE", "LL", "UL")] = m1[,c("Number", "SE_count" , "LL_count", "UL_count")] / m1$Population cc = if ("Flags" %in% names(m1)) { - c("Level", "Rate", "SE", "LL", "UL", "Flags") + c("Level", "n", "Rate", "SE", "LL", "UL", "Flags") } else { - c("Level", "Rate", "SE", "LL", "UL") + c("Level", "n", "Rate", "SE", "LL", "UL") } m1 = m1[,cc] cc = c("Rate", "SE", "LL", "UL") m1[,cc] = getOption("surveytable.tx_rate") %>% do.call(list(m1[,cc])) attr(m1, "title") = paste(.getvarname(design, vr), "(rate per", per, "population)") - attr(m1, "num") = 2:5 + attr(m1, "num") = 2:6 attr(m1, "footer") = attr(tfo, "footer") .write_out(m1, csv = csv) diff --git a/R/tab_subset_rate.R b/R/tab_subset_rate.R index 6057f60..36d0d86 100644 --- a/R/tab_subset_rate.R +++ b/R/tab_subset_rate.R @@ -67,7 +67,7 @@ tab_subset_rate = function(vr, vrby pop$Population = pop$Population / per op_ = options(surveytable.tx_count = ".tx_count_none" - , surveytable.names_count = c("Number", "SE_count", "LL_count", "UL_count")) + , surveytable.names_count = c("n", "Number", "SE_count", "LL_count", "UL_count")) on.exit(options(op_)) ret = list() @@ -91,19 +91,20 @@ tab_subset_rate = function(vr, vrby } assert_that(isTRUE(all(m1$Population > 0 | is.na(m1$Population) )) , msg = paste("Population values for each level of", vr, "must be positive.")) + m1[,c("Rate", "SE", "LL", "UL")] = NULL m1[,c("Rate", "SE", "LL", "UL")] = m1[,c("Number", "SE_count" , "LL_count", "UL_count")] / m1$Population cc = if ("Flags" %in% names(m1)) { - c("Level", "Rate", "SE", "LL", "UL", "Flags") + c("Level", "n", "Rate", "SE", "LL", "UL", "Flags") } else { - c("Level", "Rate", "SE", "LL", "UL") + c("Level", "n", "Rate", "SE", "LL", "UL") } m1 = m1[,cc] cc = c("Rate", "SE", "LL", "UL") m1[,cc] = getOption("surveytable.tx_rate") %>% do.call(list(m1[,cc])) attr(m1, "title") = paste(.getvarname(d1, vr), "(rate per", per, "population)") - attr(m1, "num") = 2:5 + attr(m1, "num") = 2:6 attr(m1, "footer") = attr(tfo, "footer") ret[[ii]] = .write_out(m1, csv = csv) diff --git a/R/total.R b/R/total.R index 8f42fbe..057c761 100644 --- a/R/total.R +++ b/R/total.R @@ -12,8 +12,6 @@ total = function(csv = getOption("surveytable.csv") ) { design = .load_survey() m1 = .total(design) - assert_that(ncol(m1) %in% c(4L, 5L)) - attr(m1, "num") = 1:4 attr(m1, "title") = "Total" .write_out(m1, csv = csv) @@ -24,7 +22,7 @@ total = function(csv = getOption("surveytable.csv") ) { ## counts = nrow(design$variables) - if (getOption("surveytable.check_present")) { + if (getOption("surveytable.find_lpe")) { pro = getOption("surveytable.present_restricted") %>% do.call(list(counts)) } else { pro = list(flags = rep("", length(counts)), has.flag = c()) @@ -35,6 +33,7 @@ total = function(csv = getOption("surveytable.csv") ) { mmcr = data.frame(x = as.numeric(sto) , s = sqrt(diag(attr(sto, "var"))) ) mmcr$counts = counts + counts_sum = sum(counts) mmcr$deff = deffK(design$prob) mmcr$samp.size = mmcr$counts / mmcr$deff @@ -51,30 +50,37 @@ total = function(csv = getOption("surveytable.csv") ) { mmcr$ll = exp(mmcr$lnx - mmcr$k) mmcr$ul = exp(mmcr$lnx + mmcr$k) - if (getOption("surveytable.check_present")) { + if (getOption("surveytable.find_lpe")) { pco = getOption("surveytable.present_count") %>% do.call(list(mmcr)) } else { pco = list(flags = rep("", nrow(mmcr)), has.flag = c()) } - mmcr = mmcr[,c("x", "s", "ll", "ul")] - mmc = getOption("surveytable.tx_count") %>% do.call(list(mmcr)) + mmc = getOption("surveytable.tx_count") %>% do.call(list(mmcr[,c("x", "s", "ll", "ul")])) + mmc$counts = mmcr$counts + mmc = mmc[,c("counts", "x", "s", "ll", "ul")] names(mmc) = getOption("surveytable.names_count") ## assert_that(nrow(mmc) == 1 - , nrow(mmcr) == 1 - , nrow(mmc) == length(pro$flags) - , nrow(mmc) == length(pco$flags)) - + , nrow(mmcr) == 1) mp = mmc - flags = paste(pro$flags, pco$flags) %>% trimws - if (any(nzchar(flags))) { - mp$Flags = flags - } - mp %<>% .add_flags( c(pro$has.flag, pco$has.flag) ) ## rownames(mp) = NULL + + attr(mp, "num") = 1:5 + attr(mp, "footer") = paste0("N = ", counts_sum, ".") + + if (getOption("surveytable.find_lpe")) { + assert_that(nrow(mmc) == length(pro$flags) + , nrow(mmc) == length(pco$flags)) + flags = paste(pro$flags, pco$flags) %>% trimws + if (any(nzchar(flags))) { + mp$Flags = flags + } + mp %<>% .add_flags( list(pro, pco) ) + } + mp } diff --git a/R/total_rate.R b/R/total_rate.R index 3ca7524..7e20b9a 100644 --- a/R/total_rate.R +++ b/R/total_rate.R @@ -21,7 +21,7 @@ total_rate = function(pop design = .load_survey() op_ = options(surveytable.tx_count = ".tx_count_none" - , surveytable.names_count = c("Number", "SE_count" + , surveytable.names_count = c("n", "Number", "SE_count" , "LL_count", "UL_count")) on.exit(options(op_)) mp = .total(design) @@ -29,18 +29,20 @@ total_rate = function(pop assert_that(nrow(mp) == 1L) m1 = mp m1$Population = pop / per + m1[,c("Rate", "SE", "LL", "UL")] = NULL m1[,c("Rate", "SE", "LL", "UL")] = m1[,c("Number", "SE_count" , "LL_count", "UL_count")] / m1$Population cc = if ("Flags" %in% names(m1)) { - c("Rate", "SE", "LL", "UL", "Flags") + c("n", "Rate", "SE", "LL", "UL", "Flags") } else { - c("Rate", "SE", "LL", "UL") + c("n", "Rate", "SE", "LL", "UL") } m1 = m1[,cc] - m1 = getOption("surveytable.tx_rate") %>% do.call(list(m1[, c("Rate", "SE", "LL", "UL")])) + cc = c("Rate", "SE", "LL", "UL") + m1[,cc] = getOption("surveytable.tx_rate") %>% do.call(list(m1[, cc])) attr(m1, "title") = paste("Total (rate per", per, "population)") - attr(m1, "num") = 1:4 + attr(m1, "num") = 1:5 attr(m1, "footer") = attr(mp, "footer") .write_out(m1, csv = csv) diff --git a/R/var_cross.R b/R/var_cross.R index f93607d..e936d51 100644 --- a/R/var_cross.R +++ b/R/var_cross.R @@ -40,7 +40,9 @@ var_cross = function(newvr, vr, vrby) { class(design$variables[,vrby])[1] )) x1 %<>% .fix_factor x2 %<>% .fix_factor - design$variables[,newvr] = forcats::fct_cross(x1, x2, sep = " : ", keep_empty = TRUE) + design$variables[,newvr] = interaction(x1, x2 + , drop = TRUE + , sep = ": ") attr(design$variables[,newvr], "label") = paste0( "(", .getvarname(design, vr), ") x (" , .getvarname(design, vrby), ")") diff --git a/R/z_present.R b/R/z_present.R index 9bf954f..a49a842 100644 --- a/R/z_present.R +++ b/R/z_present.R @@ -11,7 +11,12 @@ flags[bool] %<>% paste(f1) has.flag %<>% c(f1) } - list(flags = flags, has.flag = has.flag) + list( + id = "NCHS presentation standards" + , descriptions = c(R = + "R: If the data is confidential, suppress **all** estimates, SE's, CI's, etc.") + , flags = flags + , has.flag = has.flag) } # Table A https://www.cdc.gov/nchs/data/series/sr_02/sr02-200.pdf @@ -36,12 +41,15 @@ has.flag %<>% c(f1) } - list(flags = flags, has.flag = has.flag) + list( + id = "NCHS presentation standards" + , descriptions = c(Cx = "Cx: suppress count (and rate)" + , Cdf = "Cdf: review count (and rate) - degrees of freedom") + , flags = flags, has.flag = has.flag) } .present_count_3030 = function(mmcr , th.n = 30, th.rse = 0.30) { -# stop("30 / 30 rule no longer used") has.flag = c() flags = rep("", nrow(mmcr)) @@ -62,7 +70,12 @@ has.flag %<>% c(f1) } - list(flags = flags, has.flag = has.flag) + list( + id = "30 / 30 rule" + , descriptions = c(Cx = "Cx: suppress count (and rate)" + , Cr = "Cr: footnote count - RSE") + , flags = flags + , has.flag = has.flag) } .present_prop = function(ret) { @@ -123,5 +136,12 @@ has.flag %<>% c(f1) } - list(flags = flags, has.flag = has.flag) + list( + id = "NCHS presentation standards" + , descriptions = c(Px = "Px: suppress percent" + , Pc = "Pc: footnote percent - complement" + , Pdf = "Pdf: review percent - degrees of freedom" + , P0 = "P0: review percent - 0% or 100%") + , flags = flags + , has.flag = has.flag) } diff --git a/R/zzz.R b/R/zzz.R index 3749fa7..a82930e 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -23,13 +23,13 @@ env = new.env() options( surveytable.survey_label = "" - , surveytable.check_present = TRUE + , surveytable.find_lpe = TRUE , surveytable.present_restricted = ".present_restricted" , surveytable.present_count = ".present_count" , surveytable.present_prop = ".present_prop" , surveytable.tx_count = ".tx_count_1k" - , surveytable.names_count = c("Number (000)", "SE (000)", "LL (000)", "UL (000)") + , surveytable.names_count = c("n", "Number (000)", "SE (000)", "LL (000)", "UL (000)") , surveytable.tx_prct = ".tx_prct" , surveytable.names_prct = c("Percent", "SE", "LL", "UL") diff --git a/README.md b/README.md index 3840c47..8eb9140 100644 --- a/README.md +++ b/README.md @@ -102,11 +102,15 @@ Patient age recode {NAMCS 2019 PUF} + Level +n + + Number (000) @@ -136,6 +140,9 @@ UL Under 15 years +887 + + 117,917 @@ -165,6 +172,9 @@ Under 15 years 15-24 years +542 + + 64,856 @@ -194,6 +204,9 @@ Under 15 years 25-44 years +1,435 + + 170,271 @@ -223,6 +236,9 @@ Under 15 years 45-64 years +2,283 + + 309,506 @@ -252,6 +268,9 @@ Under 15 years 65-74 years +1,661 + + 206,866 @@ -281,6 +300,9 @@ Under 15 years 75 years and over +1,442 + + 167,069 @@ -306,8 +328,8 @@ Under 15 years - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. diff --git a/docs/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html b/docs/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html index 98cf60f..1b623dd 100644 --- a/docs/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html +++ b/docs/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html @@ -161,8 +161,12 @@

Counts and percentages + +n + + Number (000) @@ -177,6 +181,9 @@

Counts and percentages +8,250 + + 1,036,484 @@ -190,8 +197,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -210,11 +217,15 @@

Counts and percentages + Level +n + + Number (000) @@ -244,6 +255,9 @@

Counts and percentages +7,498 + + 980,280 @@ -273,6 +287,9 @@

Counts and percentages +752 + + 56,204 @@ -298,8 +315,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -316,11 +333,15 @@

Counts and percentages + Level +n + + Number (000) @@ -350,6 +371,9 @@

Counts and percentages +2,993 + + 521,466 @@ -379,6 +403,9 @@

Counts and percentages +3,050 + + 214,832 @@ -408,6 +435,9 @@

Counts and percentages +2,207 + + 300,186 @@ -433,8 +463,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -452,11 +482,15 @@

Counts and percentages + Level +n + + Number (000) @@ -486,6 +520,9 @@

Counts and percentages +7,496 + + 973,676 @@ -515,6 +552,9 @@

Counts and percentages +754 + + 62,809 @@ -540,8 +580,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -578,8 +618,12 @@

Rates + +n + + Rate @@ -594,6 +638,9 @@

Rates +8,250 + + 320.7 @@ -607,8 +654,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -639,11 +686,15 @@

Rates + Level +n + + Rate @@ -661,6 +712,9 @@

Rates MSA (Metropolitan Statistical Area) +7,496 + + 351.2 @@ -678,6 +732,9 @@

Rates Non-MSA +754 + + 136.7 @@ -691,8 +748,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -710,11 +767,15 @@

Rates + Level +n + + Rate @@ -732,6 +793,9 @@

Rates M.D. - Doctor of Medicine +7,498 + + 303.3 @@ -749,6 +813,9 @@

Rates D.O. - Doctor of Osteopathy +752 + + 17.4 @@ -762,8 +829,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -780,11 +847,15 @@

Rates + Level +n + + Rate @@ -802,6 +873,9 @@

Rates Primary care specialty +2,993 + + 161.4 @@ -819,6 +893,9 @@

Rates Surgical care specialty +3,050 + + 66.5 @@ -836,6 +913,9 @@

Rates Medical care specialty +2,207 + + 92.9 @@ -849,8 +929,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -934,11 +1014,15 @@

Counts and percentages + Level +n + + Number (000) @@ -968,6 +1052,9 @@

Counts and percentages +887 + + 117,917 @@ -997,6 +1084,9 @@

Counts and percentages +542 + + 64,856 @@ -1026,6 +1116,9 @@

Counts and percentages +1,435 + + 170,271 @@ -1055,6 +1148,9 @@

Counts and percentages +2,283 + + 309,506 @@ -1084,6 +1180,9 @@

Counts and percentages +1,661 + + 206,866 @@ -1113,6 +1212,9 @@

Counts and percentages +1,442 + + 167,069 @@ -1138,8 +1240,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1156,11 +1258,15 @@

Counts and percentages + Level +n + + Number (000) @@ -1190,6 +1296,9 @@

Counts and percentages +203 + + 31,148 @@ -1219,6 +1328,9 @@

Counts and percentages +281 + + 38,240 @@ -1248,6 +1360,9 @@

Counts and percentages +403 + + 48,529 @@ -1277,6 +1392,9 @@

Counts and percentages +4,260 + + 544,632 @@ -1306,6 +1424,9 @@

Counts and percentages +3,103 + + 373,935 @@ -1331,8 +1452,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1349,11 +1470,15 @@

Counts and percentages + Level +n + + Number (000) @@ -1383,6 +1508,9 @@

Counts and percentages +4,609 + + 605,045 @@ -1412,6 +1540,9 @@

Counts and percentages +3,641 + + 431,439 @@ -1437,8 +1568,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1457,11 +1588,15 @@

Counts and percentages + Level +n + + Number (000) @@ -1488,7 +1623,10 @@

Counts and percentages -Under 15 years : Female +Under 15 years: Female + + +434 59,958 @@ -1517,7 +1655,10 @@

Counts and percentages -15-24 years : Female +15-24 years: Female + + +346 41,128 @@ -1546,7 +1687,10 @@

Counts and percentages -25-44 years : Female +25-44 years: Female + + +923 113,708 @@ -1575,7 +1719,10 @@

Counts and percentages -45-64 years : Female +45-64 years: Female + + +1,253 175,978 @@ -1604,7 +1751,10 @@

Counts and percentages -65-74 years : Female +65-74 years: Female + + +891 120,099 @@ -1633,7 +1783,10 @@

Counts and percentages -75 years and over : Female +75 years and over: Female + + +762 94,173 @@ -1662,7 +1815,10 @@

Counts and percentages -Under 15 years : Male +Under 15 years: Male + + +453 57,959 @@ -1691,7 +1847,10 @@

Counts and percentages -15-24 years : Male +15-24 years: Male + + +196 23,728 @@ -1720,7 +1879,10 @@

Counts and percentages -25-44 years : Male +25-44 years: Male + + +512 56,562 @@ -1749,7 +1911,10 @@

Counts and percentages -45-64 years : Male +45-64 years: Male + + +1,030 133,528 @@ -1778,7 +1943,10 @@

Counts and percentages -65-74 years : Male +65-74 years: Male + + +770 86,766 @@ -1807,7 +1975,10 @@

Counts and percentages -75 years and over : Male +75 years and over: Male + + +680 72,896 @@ -1835,8 +2006,8 @@

Counts and percentages - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1855,11 +2026,15 @@

Rates + Level +n + + Rate @@ -1877,6 +2052,9 @@

Rates Under 15 years +887 + + 194.8 @@ -1894,6 +2072,9 @@

Rates 15-24 years +542 + + 155.5 @@ -1911,6 +2092,9 @@

Rates 25-44 years +1,435 + + 198.9 @@ -1928,6 +2112,9 @@

Rates 45-64 years +2,283 + + 374.9 @@ -1945,6 +2132,9 @@

Rates 65-74 years +1,661 + + 661.8 @@ -1962,6 +2152,9 @@

Rates 75 years and over +1,442 + + 776.4 @@ -1975,8 +2168,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1992,11 +2185,15 @@

Rates + Level +n + + Rate @@ -2014,6 +2211,9 @@

Rates Under 1 +203 + + 823.7 @@ -2031,6 +2231,9 @@

Rates 1-4 +281 + + 242.2 @@ -2048,6 +2251,9 @@

Rates 5-14 +403 + + 118.5 @@ -2065,6 +2271,9 @@

Rates 15-64 +4,260 + +    @@ -2082,6 +2291,9 @@

Rates 65 and over +3,103 + + 708.5 @@ -2095,8 +2307,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2111,11 +2323,15 @@

Rates + Level +n + + Rate @@ -2133,6 +2349,9 @@

Rates Female +4,609 + + 366.4 @@ -2150,6 +2369,9 @@

Rates Male +3,641 + + 273   @@ -2163,8 +2385,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2199,11 +2421,15 @@

Rates + Level +n + + Rate @@ -2221,6 +2447,9 @@

Rates Under 15 years +434 + + 202.5 @@ -2238,6 +2467,9 @@

Rates 15-24 years +346 + + 198.4 @@ -2255,6 +2487,9 @@

Rates 25-44 years +923 + + 263.3 @@ -2272,6 +2507,9 @@

Rates 45-64 years +1,253 + + 414   @@ -2289,6 +2527,9 @@

Rates 65-74 years +891 + + 720.3 @@ -2306,6 +2547,9 @@

Rates 75 years and over +762 + + 758.1 @@ -2319,8 +2563,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 4609. Checked NCHS presentation standards. Nothing to report. @@ -2334,11 +2578,15 @@

Rates + Level +n + + Rate @@ -2356,6 +2604,9 @@

Rates Under 15 years +453 + + 187.4 @@ -2373,6 +2624,9 @@

Rates 15-24 years +196 + + 113.1 @@ -2390,6 +2644,9 @@

Rates 25-44 years +512 + + 133.4 @@ -2407,6 +2664,9 @@

Rates 45-64 years +1,030 + + 333.4 @@ -2424,6 +2684,9 @@

Rates 65-74 years +770 + + 594.8 @@ -2441,6 +2704,9 @@

Rates 75 years and over +680 + + 801.2 @@ -2454,8 +2720,8 @@

Rates - -(Checked presentation standards. Nothing to report.) + +N = 3641. Checked NCHS presentation standards. Nothing to report. @@ -2505,11 +2771,15 @@

Table 5 + Level +n + + Number (000) @@ -2539,6 +2809,9 @@

Table 5 +3,395 + + 436,331 @@ -2568,6 +2841,9 @@

Table 5 +4,855 + + 600,153 @@ -2593,8 +2869,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2611,11 +2887,15 @@

Table 5 + Level +n + + Number (000) @@ -2645,6 +2925,9 @@

Table 5 +5,539 + + 717,764 @@ -2674,6 +2957,9 @@

Table 5 +2,711 + + 318,721 @@ -2699,8 +2985,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2718,11 +3004,15 @@

Table 5 + Level +n + + Number (000) @@ -2752,6 +3042,9 @@

Table 5 +7,223 + + 894,590 @@ -2781,6 +3074,9 @@

Table 5 +1,027 + + 141,894 @@ -2806,8 +3102,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2824,11 +3120,15 @@

Table 5 + Level +n + + Number (000) @@ -2858,6 +3158,9 @@

Table 5 +8,126 + + 1,016,202 @@ -2887,6 +3190,9 @@

Table 5 +124 + + 20,282 @@ -2912,8 +3218,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2931,11 +3237,15 @@

Table 5 + Level +n + + Number (000) @@ -2968,6 +3278,9 @@

Table 5 +7,945 + + 994,579 @@ -3000,6 +3313,9 @@

Table 5 +305 + + 41,906 @@ -3028,9 +3344,9 @@

Table 5 - -Cx: suppress count (and rate); Px: suppress percent; Pc: footnote -percent - complement + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate); Px: suppress percent; Pc: footnote percent - complement. @@ -3048,11 +3364,15 @@

Table 5 + Level +n + + Number (000) @@ -3085,6 +3405,9 @@

Table 5 +7,951 + + 994,770 @@ -3117,6 +3440,9 @@

Table 5 +299 + + 41,715 @@ -3145,9 +3471,9 @@

Table 5 - -Cx: suppress count (and rate); Px: suppress percent; Pc: footnote -percent - complement + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate); Px: suppress percent; Pc: footnote percent - complement. @@ -3165,11 +3491,15 @@

Table 5 + Level +n + + Number (000) @@ -3202,6 +3532,9 @@

Table 5 +8,243 + + 1,036,081 @@ -3233,6 +3566,9 @@

Table 5 +7 + + 404 @@ -3261,8 +3597,9 @@

Table 5 - -Cx: suppress count (and rate) + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate). @@ -3281,11 +3618,15 @@

Table 5 + Level +n + + Number (000) @@ -3318,6 +3659,9 @@

Table 5 +8,148 + + 994,493 @@ -3350,6 +3694,9 @@

Table 5 +102 + + 41,991 @@ -3378,9 +3725,9 @@

Table 5 - -Cx: suppress count (and rate); Px: suppress percent; Pc: footnote -percent - complement + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate); Px: suppress percent; Pc: footnote percent - complement. @@ -3397,11 +3744,15 @@

Table 5 + Level +n + + Number (000) @@ -3431,6 +3782,9 @@

Table 5 +8,077 + + 1,017,442 @@ -3460,6 +3814,9 @@

Table 5 +173 + + 19,042 @@ -3485,8 +3842,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -3503,11 +3860,15 @@

Table 5 + Level +n + + Number (000) @@ -3537,6 +3898,9 @@

Table 5 +7,879 + + 1,004,918 @@ -3566,6 +3930,9 @@

Table 5 +371 + + 31,567 @@ -3591,8 +3958,8 @@

Table 5 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -3626,11 +3993,15 @@

Table 6 + Level +n + + Number (000) @@ -3660,6 +4031,9 @@

Table 6 +316 + + 40,669 @@ -3689,6 +4063,9 @@

Table 6 +2,278 + + 383,481 @@ -3718,6 +4095,9 @@

Table 6 +5,656 + + 612,335 @@ -3743,8 +4123,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -3761,11 +4141,15 @@

Table 6 + Level +n + + Number (000) @@ -3795,6 +4179,9 @@

Table 6 +874 + + 87,560 @@ -3824,6 +4211,9 @@

Table 6 +2,278 + + 383,481 @@ -3853,6 +4243,9 @@

Table 6 +2,134 + + 264,044 @@ -3882,6 +4275,9 @@

Table 6 +2,964 + + 301,400 @@ -3907,8 +4303,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -3925,11 +4321,15 @@

Table 6 + Level +n + + Number (000) @@ -3959,6 +4359,9 @@

Table 6 +6,771 + + 862,626 @@ -3988,6 +4391,9 @@

Table 6 +1,479 + + 173,859 @@ -4013,8 +4419,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -4037,11 +4443,15 @@

Table 6 + Level +n + + Number (000) @@ -4071,6 +4481,9 @@

Table 6 +236 + + 28,494 @@ -4100,6 +4513,9 @@

Table 6 +2,127 + + 359,164 @@ -4129,6 +4545,9 @@

Table 6 +4,408 + + 474,967 @@ -4154,8 +4573,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 6771. Checked NCHS presentation standards. Nothing to report. @@ -4174,11 +4593,15 @@

Table 6 + Level +n + + Number (000) @@ -4211,6 +4634,9 @@

Table 6 +80 + + 12,174 @@ -4243,6 +4669,9 @@

Table 6 +151 + + 24,317 @@ -4274,6 +4703,9 @@

Table 6 +1,248 + + 137,368 @@ -4301,8 +4733,9 @@

Table 6 - -Cx: suppress count (and rate); Px: suppress percent + +N = 1479. Checked NCHS presentation standards: Cx: suppress count (and +rate); Px: suppress percent. @@ -4322,11 +4755,15 @@

Table 6 + Level +n + + Number (000) @@ -4356,6 +4793,9 @@

Table 6 +606 + + 58,208 @@ -4385,6 +4825,9 @@

Table 6 +2,127 + + 359,164 @@ -4414,6 +4857,9 @@

Table 6 +1,324 + + 172,899 @@ -4443,6 +4889,9 @@

Table 6 +2,714 + + 272,354 @@ -4468,8 +4917,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 6771. Checked NCHS presentation standards. Nothing to report. @@ -4487,11 +4936,15 @@

Table 6 + Level +n + + Number (000) @@ -4521,6 +4974,9 @@

Table 6 +268 + + 29,351 @@ -4550,6 +5006,9 @@

Table 6 +151 + + 24,317 @@ -4579,6 +5038,9 @@

Table 6 +810 + + 91,145 @@ -4608,6 +5070,9 @@

Table 6 +250 + + 29,046 @@ -4633,8 +5098,8 @@

Table 6 - -(Checked presentation standards. Nothing to report.) + +N = 1479. Checked NCHS presentation standards. Nothing to report. @@ -4673,11 +5138,15 @@

Table 11 + Level +n + + Number (000) @@ -4707,6 +5176,9 @@

Table 11 +175 + + 15,887 @@ -4736,6 +5208,9 @@

Table 11 +2,193 + + 275,014 @@ -4765,6 +5240,9 @@

Table 11 +2,861 + + 380,910 @@ -4794,6 +5272,9 @@

Table 11 +635 + + 74,017 @@ -4823,6 +5304,9 @@

Table 11 +159 + + 12,864 @@ -4852,6 +5336,9 @@

Table 11 +659 + + 54,170 @@ -4881,6 +5368,9 @@

Table 11 +1,568 + + 223,624 @@ -4906,8 +5396,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -4929,11 +5419,15 @@

Table 11 + Level +n + + Number (000) @@ -4963,6 +5457,9 @@

Table 11 +300 + + 50,701 @@ -4992,6 +5489,9 @@

Table 11 +121 + + 18,196 @@ -5021,6 +5521,9 @@

Table 11 +370 + + 50,573 @@ -5050,6 +5553,9 @@

Table 11 +355 + + 53,805 @@ -5079,6 +5585,9 @@

Table 11 +225 + + 27,985 @@ -5108,6 +5617,9 @@

Table 11 +197 + + 22,363 @@ -5133,8 +5645,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -5154,11 +5666,15 @@

Table 11 + Level +n + + Number (000) @@ -5188,6 +5704,9 @@

Table 11 +118 + + 19,094 @@ -5217,6 +5736,9 @@

Table 11 +86 + + 14,819 @@ -5246,6 +5768,9 @@

Table 11 +96 + + 16,788 @@ -5275,6 +5800,9 @@

Table 11 +846 + + 122,574 @@ -5304,6 +5832,9 @@

Table 11 +422 + + 50,349 @@ -5329,8 +5860,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -5350,11 +5881,15 @@

Table 11 + Level +n + + Number (000) @@ -5384,6 +5919,9 @@

Table 11 +1,014 + + 139,091 @@ -5413,6 +5951,9 @@

Table 11 +554 + + 84,532 @@ -5438,8 +5979,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -5459,11 +6000,15 @@

Table 11 + Level +n + + Number (000) @@ -5490,7 +6035,10 @@

Table 11 -Under 15 years : Female +Under 15 years: Female + + +157 28,138 @@ -5519,7 +6067,10 @@

Table 11 -15-24 years : Female +15-24 years: Female + + +96 12,866 @@ -5548,7 +6099,10 @@

Table 11 -25-44 years : Female +25-44 years: Female + + +305 40,612 @@ -5577,7 +6131,10 @@

Table 11 -45-64 years : Female +45-64 years: Female + + +233 31,373 @@ -5606,7 +6163,10 @@

Table 11 -65-74 years : Female +65-74 years: Female + + +119 13,842 @@ -5635,7 +6195,10 @@

Table 11 -75 years and over : Female +75 years and over: Female + + +104 12,259 @@ -5664,7 +6227,10 @@

Table 11 -Under 15 years : Male +Under 15 years: Male + + +143 22,563 @@ -5693,7 +6259,10 @@

Table 11 -15-24 years : Male +15-24 years: Male + + +25 5,330 @@ -5722,7 +6291,10 @@

Table 11 -25-44 years : Male +25-44 years: Male + + +65 9,961 @@ -5751,7 +6323,10 @@

Table 11 -45-64 years : Male +45-64 years: Male + + +122 22,432 @@ -5780,7 +6355,10 @@

Table 11 -65-74 years : Male +65-74 years: Male + + +106 14,143 @@ -5809,7 +6387,10 @@

Table 11 -75 years and over : Male +75 years and over: Male + + +93 10,104 @@ -5837,8 +6418,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -5863,11 +6444,15 @@

Table 11 + Level +n + + Number (000) @@ -5897,6 +6482,9 @@

Table 11 +300 + + 50,701 @@ -5926,6 +6514,9 @@

Table 11 +121 + + 18,196 @@ -5955,6 +6546,9 @@

Table 11 +370 + + 50,573 @@ -5984,6 +6578,9 @@

Table 11 +355 + + 53,805 @@ -6013,6 +6610,9 @@

Table 11 +225 + + 27,985 @@ -6042,6 +6642,9 @@

Table 11 +197 + + 22,363 @@ -6067,8 +6670,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -6086,11 +6689,15 @@

Table 11 + Level +n + + Number (000) @@ -6120,6 +6727,9 @@

Table 11 +118 + + 19,094 @@ -6149,6 +6759,9 @@

Table 11 +86 + + 14,819 @@ -6178,6 +6791,9 @@

Table 11 +96 + + 16,788 @@ -6207,6 +6823,9 @@

Table 11 +846 + + 122,574 @@ -6236,6 +6855,9 @@

Table 11 +422 + + 50,349 @@ -6261,8 +6883,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -6280,11 +6902,15 @@

Table 11 + Level +n + + Number (000) @@ -6314,6 +6940,9 @@

Table 11 +1,014 + + 139,091 @@ -6343,6 +6972,9 @@

Table 11 +554 + + 84,532 @@ -6368,8 +7000,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -6387,11 +7019,15 @@

Table 11 + Level +n + + Number (000) @@ -6418,7 +7054,10 @@

Table 11 -Under 15 years : Female +Under 15 years: Female + + +157 28,138 @@ -6447,7 +7086,10 @@

Table 11 -15-24 years : Female +15-24 years: Female + + +96 12,866 @@ -6476,7 +7118,10 @@

Table 11 -25-44 years : Female +25-44 years: Female + + +305 40,612 @@ -6505,7 +7150,10 @@

Table 11 -45-64 years : Female +45-64 years: Female + + +233 31,373 @@ -6534,7 +7182,10 @@

Table 11 -65-74 years : Female +65-74 years: Female + + +119 13,842 @@ -6563,7 +7214,10 @@

Table 11 -75 years and over : Female +75 years and over: Female + + +104 12,259 @@ -6592,7 +7246,10 @@

Table 11 -Under 15 years : Male +Under 15 years: Male + + +143 22,563 @@ -6621,7 +7278,10 @@

Table 11 -15-24 years : Male +15-24 years: Male + + +25 5,330 @@ -6650,7 +7310,10 @@

Table 11 -25-44 years : Male +25-44 years: Male + + +65 9,961 @@ -6679,7 +7342,10 @@

Table 11 -45-64 years : Male +45-64 years: Male + + +122 22,432 @@ -6708,7 +7374,10 @@

Table 11 -65-74 years : Male +65-74 years: Male + + +106 14,143 @@ -6737,7 +7406,10 @@

Table 11 -75 years and over : Male +75 years and over: Male + + +93 10,104 @@ -6765,8 +7437,8 @@

Table 11 - -(Checked presentation standards. Nothing to report.) + +N = 1568. Checked NCHS presentation standards. Nothing to report. @@ -6788,7 +7460,7 @@

More advanced codingfor (vr in c("AGER", "Age group", "SEX", "Age x Sex")) { var_cross("tmp", "MAJOR", vr) for (lvl in levels(surveytable:::env$survey$variables[,vr])) { - tab_subset("SPECCAT", "tmp", paste0("Preventive care : ", lvl)) + tab_subset("SPECCAT", "tmp", paste0("Preventive care: ", lvl)) } } ## Warning in var_cross("tmp", "MAJOR", vr): tmp: overwriting a variable that @@ -6819,8 +7491,9 @@

More advanced coding followed by lvl, which is +some level of vr, such as “Under 15 years” for +AGER.
  • Finally, CSV output is turned off.
  • If you run this code, all of the tables should be stored in the CSV @@ -6832,11 +7505,11 @@

    More advanced coding## Warning in var_cross("tmp", "MAJOR", vr): tmp: overwriting a variable that ## already exists. lvl = levels(surveytable:::env$survey$variables[,vr])[1] -tab_subset("SPECCAT", "tmp", paste0("Preventive care : ", lvl)) +tab_subset("SPECCAT", "tmp", paste0("Preventive care: ", lvl)) @@ -6849,11 +7522,15 @@

    More advanced coding Level

    + + +
    Type of specialty (Primary, Medical, Surgical) ((Major reason for this -visit) x (Patient age recode) = Preventive care : Under 15 years) {NAMCS +visit) x (Patient age recode) = Preventive care: Under 15 years) {NAMCS 2019 PUF}
    +n + Number (000) @@ -6886,6 +7563,9 @@

    More advanced coding +289 + +

    49,978 @@ -6918,6 +7598,9 @@

    More advanced coding +4 +

    149 @@ -6950,6 +7633,9 @@

    More advanced coding +7 +

    574 @@ -6978,10 +7664,11 @@

    More advanced coding -R: If the data is confidential, suppress all estimates, SE’s, -CI’s, etc.; Cx: suppress count (and rate); Px: suppress percent; Pc: -footnote percent - complement +

    +N = 300. Checked NCHS presentation standards: R: If the data is +confidential, suppress all estimates, SE’s, CI’s, etc.; +Cx: suppress count (and rate); Px: suppress percent; Pc: footnote +percent - complement.
    diff --git a/docs/articles/surveytable.html b/docs/articles/surveytable.html index d3897e6..d6259a3 100644 --- a/docs/articles/surveytable.html +++ b/docs/articles/surveytable.html @@ -360,11 +360,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -394,6 +398,9 @@

    Tabulate categorical and log Under 15 years +887 + + 117,917 @@ -423,6 +430,9 @@

    Tabulate categorical and log 15-24 years +542 + + 64,856 @@ -452,6 +462,9 @@

    Tabulate categorical and log 25-44 years +1,435 + + 170,271 @@ -481,6 +494,9 @@

    Tabulate categorical and log 45-64 years +2,283 + + 309,506 @@ -510,6 +526,9 @@

    Tabulate categorical and log 65-74 years +1,661 + + 206,866 @@ -539,6 +558,9 @@

    Tabulate categorical and log 75 years and over +1,442 + + 167,069 @@ -564,8 +586,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -605,11 +627,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -642,6 +668,9 @@

    Tabulate categorical and log FALSE +8,234 + + 1,034,338 @@ -673,6 +702,9 @@

    Tabulate categorical and log TRUE +16 + + 2,146 @@ -701,8 +733,9 @@

    Tabulate categorical and log - -Cx: suppress count (and rate) + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate). @@ -730,11 +763,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -764,6 +801,9 @@

    Tabulate categorical and log Primary care specialty +2,406 + + 422,807 @@ -793,6 +833,9 @@

    Tabulate categorical and log Surgical care specialty +2,444 + + 170,714 @@ -822,6 +865,9 @@

    Tabulate categorical and log Medical care specialty +1,750 + + 235,502 @@ -851,6 +897,9 @@

    Tabulate categorical and log <N/A> +1,650 + + 207,462 @@ -876,8 +925,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -898,11 +947,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -932,6 +985,9 @@

    Tabulate categorical and log Primary care specialty +2,406 + + 422,807 @@ -961,6 +1017,9 @@

    Tabulate categorical and log Surgical care specialty +2,444 + + 170,714 @@ -990,6 +1049,9 @@

    Tabulate categorical and log Medical care specialty +1,750 + + 235,502 @@ -1015,8 +1077,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 6600. Checked NCHS presentation standards. Nothing to report. @@ -1039,11 +1101,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -1073,6 +1139,9 @@

    Tabulate categorical and log M.D. - Doctor of Medicine +7,498 + + 980,280 @@ -1102,6 +1171,9 @@

    Tabulate categorical and log D.O. - Doctor of Osteopathy +752 + + 56,204 @@ -1127,8 +1199,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1145,11 +1217,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -1179,6 +1255,9 @@

    Tabulate categorical and log Primary care specialty +2,993 + + 521,466 @@ -1208,6 +1287,9 @@

    Tabulate categorical and log Surgical care specialty +3,050 + + 214,832 @@ -1237,6 +1319,9 @@

    Tabulate categorical and log Medical care specialty +2,207 + + 300,186 @@ -1262,8 +1347,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1281,11 +1366,15 @@

    Tabulate categorical and log + Level +n + + Number (000) @@ -1315,6 +1404,9 @@

    Tabulate categorical and log MSA (Metropolitan Statistical Area) +7,496 + + 973,676 @@ -1344,6 +1436,9 @@

    Tabulate categorical and log Non-MSA +754 + + 62,809 @@ -1369,8 +1464,8 @@

    Tabulate categorical and log - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1389,8 +1484,12 @@

    Entire population +n + + Number (000) @@ -1405,6 +1504,9 @@

    Entire population +8,250 + + 1,036,484 @@ -1418,8 +1520,8 @@

    Entire population -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -1444,11 +1546,15 @@

    Subsets or interactions + Level +n + + Number (000) @@ -1478,6 +1584,9 @@

    Subsets or interactions +434 + + 59,958 @@ -1507,6 +1616,9 @@

    Subsets or interactions +346 + + 41,128 @@ -1536,6 +1648,9 @@

    Subsets or interactions +923 + + 113,708 @@ -1565,6 +1680,9 @@

    Subsets or interactions +1,253 + + 175,978 @@ -1594,6 +1712,9 @@

    Subsets or interactions +891 + + 120,099 @@ -1623,6 +1744,9 @@

    Subsets or interactions +762 + + 94,173 @@ -1648,8 +1772,8 @@

    Subsets or interactions - -(Checked presentation standards. Nothing to report.) + +N = 4609. Checked NCHS presentation standards. Nothing to report. @@ -1666,11 +1790,15 @@

    Subsets or interactions + Level +n + + Number (000) @@ -1700,6 +1828,9 @@

    Subsets or interactions +453 + + 57,959 @@ -1729,6 +1860,9 @@

    Subsets or interactions +196 + + 23,728 @@ -1758,6 +1892,9 @@

    Subsets or interactions +512 + + 56,562 @@ -1787,6 +1924,9 @@

    Subsets or interactions +1,030 + + 133,528 @@ -1816,6 +1956,9 @@

    Subsets or interactions +770 + + 86,766 @@ -1845,6 +1988,9 @@

    Subsets or interactions +680 + + 72,896 @@ -1870,8 +2016,8 @@

    Subsets or interactions - -(Checked presentation standards. Nothing to report.) + +N = 3641. Checked NCHS presentation standards. Nothing to report. @@ -1899,11 +2045,15 @@

    Subsets or interactions + Level +n + + Number (000) @@ -1930,7 +2080,10 @@

    Subsets or interactions -Under 15 years : Female +Under 15 years: Female + + +434 59,958 @@ -1959,7 +2112,10 @@

    Subsets or interactions -15-24 years : Female +15-24 years: Female + + +346 41,128 @@ -1988,7 +2144,10 @@

    Subsets or interactions -25-44 years : Female +25-44 years: Female + + +923 113,708 @@ -2017,7 +2176,10 @@

    Subsets or interactions -45-64 years : Female +45-64 years: Female + + +1,253 175,978 @@ -2046,7 +2208,10 @@

    Subsets or interactions -65-74 years : Female +65-74 years: Female + + +891 120,099 @@ -2075,7 +2240,10 @@

    Subsets or interactions -75 years and over : Female +75 years and over: Female + + +762 94,173 @@ -2104,7 +2272,10 @@

    Subsets or interactions -Under 15 years : Male +Under 15 years: Male + + +453 57,959 @@ -2133,7 +2304,10 @@

    Subsets or interactions -15-24 years : Male +15-24 years: Male + + +196 23,728 @@ -2162,7 +2336,10 @@

    Subsets or interactions -25-44 years : Male +25-44 years: Male + + +512 56,562 @@ -2191,7 +2368,10 @@

    Subsets or interactions -45-64 years : Male +45-64 years: Male + + +1,030 133,528 @@ -2220,7 +2400,10 @@

    Subsets or interactions -65-74 years : Male +65-74 years: Male + + +770 86,766 @@ -2249,7 +2432,10 @@

    Subsets or interactions -75 years and over : Male +75 years and over: Male + + +680 72,896 @@ -2277,8 +2463,8 @@

    Subsets or interactions - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -2506,11 +2692,15 @@

    Categorical variables + Level +n + + Number (000) @@ -2540,6 +2730,9 @@

    Categorical variables +609 + + 102,720 @@ -2569,6 +2762,9 @@

    Categorical variables +247 + + 40,808 @@ -2598,6 +2794,9 @@

    Categorical variables +626 + + 95,305 @@ -2627,6 +2826,9 @@

    Categorical variables +726 + + 124,384 @@ -2656,6 +2858,9 @@

    Categorical variables +411 + + 85,504 @@ -2685,6 +2890,9 @@

    Categorical variables +374 + + 72,745 @@ -2710,8 +2918,8 @@

    Categorical variables - -(Checked presentation standards. Nothing to report.) + +N = 2993. Checked NCHS presentation standards. Nothing to report. @@ -2729,11 +2937,15 @@

    Categorical variables + Level +n + + Number (000) @@ -2763,6 +2975,9 @@

    Categorical variables +191 + + 6,201 @@ -2792,6 +3007,9 @@

    Categorical variables +129 + + 8,561 @@ -2821,6 +3039,9 @@

    Categorical variables +435 + + 35,953 @@ -2850,6 +3071,9 @@

    Categorical variables +900 + + 73,204 @@ -2879,6 +3103,9 @@

    Categorical variables +787 + + 53,482 @@ -2908,6 +3135,9 @@

    Categorical variables +608 + + 37,431 @@ -2933,8 +3163,8 @@

    Categorical variables - -(Checked presentation standards. Nothing to report.) + +N = 3050. Checked NCHS presentation standards. Nothing to report. @@ -2952,11 +3182,15 @@

    Categorical variables + Level +n + + Number (000) @@ -2986,6 +3220,9 @@

    Categorical variables +87 + + 8,996 @@ -3015,6 +3252,9 @@

    Categorical variables +166 + + 15,487 @@ -3044,6 +3284,9 @@

    Categorical variables +374 + + 39,012 @@ -3073,6 +3316,9 @@

    Categorical variables +657 + + 111,918 @@ -3102,6 +3348,9 @@

    Categorical variables +463 + + 67,880 @@ -3131,6 +3380,9 @@

    Categorical variables +460 + + 56,894 @@ -3156,8 +3408,8 @@

    Categorical variables - -(Checked presentation standards. Nothing to report.) + +N = 2207. Checked NCHS presentation standards. Nothing to report. @@ -4339,11 +4591,15 @@

    Categorical variables + Level +n + + Number (000) @@ -4376,6 +4632,9 @@

    Categorical variables +2,973 + + 515,172 @@ -4407,6 +4666,9 @@

    Categorical variables +20 + + 6,295 @@ -4435,8 +4697,9 @@

    Categorical variables - -Cx: suppress count (and rate) + +N = 2993. Checked NCHS presentation standards: Cx: suppress count (and +rate). @@ -4454,11 +4717,15 @@

    Categorical variables + Level +n + + Number (000) @@ -4488,6 +4755,9 @@

    Categorical variables +2,968 + + 207,915 @@ -4517,6 +4787,9 @@

    Categorical variables +82 + + 6,917 @@ -4542,8 +4815,8 @@

    Categorical variables - -(Checked presentation standards. Nothing to report.) + +N = 3050. Checked NCHS presentation standards. Nothing to report. @@ -4562,11 +4835,15 @@

    Categorical variables + Level +n + + Number (000) @@ -4599,6 +4876,9 @@

    Categorical variables +2,163 + + 291,560 @@ -4631,6 +4911,9 @@

    Categorical variables +44 + + 8,626 @@ -4659,9 +4942,9 @@

    Categorical variables - -Cx: suppress count (and rate); Px: suppress percent; Pc: footnote -percent - complement + +N = 2207. Checked NCHS presentation standards: Cx: suppress count (and +rate); Px: suppress percent; Pc: footnote percent - complement. @@ -5591,11 +5874,15 @@

    Categorical variables (single var + Level +n + + Number (000) @@ -5625,6 +5912,9 @@

    Categorical variables (single var Primary care specialty +2,993 + + 521,466 @@ -5654,6 +5944,9 @@

    Categorical variables (single var Surgical care specialty +3,050 + + 214,832 @@ -5683,6 +5976,9 @@

    Categorical variables (single var Medical care specialty +2,207 + + 300,186 @@ -5708,8 +6004,8 @@

    Categorical variables (single var - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -5825,8 +6121,12 @@

    Calculate rates + +n + + Rate @@ -5841,6 +6141,9 @@

    Calculate rates +8,250 + + 320.7 @@ -5854,8 +6157,8 @@

    Calculate rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -5887,11 +6190,15 @@

    Calculate rates + Level +n + + Rate @@ -5909,6 +6216,9 @@

    Calculate rates +887 + + 194.8 @@ -5926,6 +6236,9 @@

    Calculate rates +542 + + 155.5 @@ -5943,6 +6256,9 @@

    Calculate rates +1,435 + + 198.9 @@ -5960,6 +6276,9 @@

    Calculate rates +2,283 + + 374.9 @@ -5977,6 +6296,9 @@

    Calculate rates +1,661 + + 661.8 @@ -5994,6 +6316,9 @@

    Calculate rates +1,442 + + 776.4 @@ -6007,8 +6332,8 @@

    Calculate rates - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -6043,11 +6368,15 @@

    Calculate rates + Level +n + + Rate @@ -6065,6 +6394,9 @@

    Calculate rates +434 + + 202.5 @@ -6082,6 +6414,9 @@

    Calculate rates +346 + + 198.4 @@ -6099,6 +6434,9 @@

    Calculate rates +923 + + 263.3 @@ -6116,6 +6454,9 @@

    Calculate rates +1,253 + + 414   @@ -6133,6 +6474,9 @@

    Calculate rates +891 + + 720.3 @@ -6150,6 +6494,9 @@

    Calculate rates +762 + + 758.1 @@ -6163,8 +6510,8 @@

    Calculate rates - -(Checked presentation standards. Nothing to report.) + +N = 4609. Checked NCHS presentation standards. Nothing to report. @@ -6178,11 +6525,15 @@

    Calculate rates + Level +n + + Rate @@ -6200,6 +6551,9 @@

    Calculate rates +453 + + 187.4 @@ -6217,6 +6571,9 @@

    Calculate rates +196 + + 113.1 @@ -6234,6 +6591,9 @@

    Calculate rates +512 + + 133.4 @@ -6251,6 +6611,9 @@

    Calculate rates +1,030 + + 333.4 @@ -6268,6 +6631,9 @@

    Calculate rates +770 + + 594.8 @@ -6285,6 +6651,9 @@

    Calculate rates +680 + + 801.2 @@ -6298,8 +6667,8 @@

    Calculate rates - -(Checked presentation standards. Nothing to report.) + +N = 3641. Checked NCHS presentation standards. Nothing to report. @@ -6326,11 +6695,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -6360,6 +6733,9 @@

    Create or modify variables +175 + + 15,887 @@ -6389,6 +6765,9 @@

    Create or modify variables +2,193 + + 275,014 @@ -6418,6 +6797,9 @@

    Create or modify variables +2,861 + + 380,910 @@ -6447,6 +6829,9 @@

    Create or modify variables +635 + + 74,017 @@ -6476,6 +6861,9 @@

    Create or modify variables +159 + + 12,864 @@ -6505,6 +6893,9 @@

    Create or modify variables +659 + + 54,170 @@ -6534,6 +6925,9 @@

    Create or modify variables +1,568 + + 223,624 @@ -6559,8 +6953,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -6587,11 +6981,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -6621,6 +7019,9 @@

    Create or modify variables +6,682 + + 812,861 @@ -6650,6 +7051,9 @@

    Create or modify variables +1,568 + + 223,624 @@ -6675,8 +7079,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -6707,11 +7111,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -6741,6 +7149,9 @@

    Create or modify variables +7,432 + + 969,451 @@ -6770,6 +7181,9 @@

    Create or modify variables +818 + + 67,034 @@ -6795,8 +7209,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -6819,11 +7233,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -6856,6 +7274,9 @@

    Create or modify variables +16 + + 1,150 @@ -6888,6 +7309,9 @@

    Create or modify variables +300 + + 39,519 @@ -6919,6 +7343,9 @@

    Create or modify variables +2,278 + + 383,481 @@ -6950,6 +7377,9 @@

    Create or modify variables +5,656 + + 612,335 @@ -6977,8 +7407,9 @@

    Create or modify variables - -Cx: suppress count (and rate) + +N = 8250. Checked NCHS presentation standards: Cx: suppress count (and +rate). @@ -7000,11 +7431,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7034,6 +7469,9 @@

    Create or modify variables +316 + + 40,669 @@ -7063,6 +7501,9 @@

    Create or modify variables +2,278 + + 383,481 @@ -7092,6 +7533,9 @@

    Create or modify variables +5,656 + + 612,335 @@ -7117,8 +7561,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -7183,11 +7627,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7217,6 +7665,9 @@

    Create or modify variables +203 + + 31,148 @@ -7246,6 +7697,9 @@

    Create or modify variables +281 + + 38,240 @@ -7275,6 +7729,9 @@

    Create or modify variables +403 + + 48,529 @@ -7304,6 +7761,9 @@

    Create or modify variables +4,260 + + 544,632 @@ -7333,6 +7793,9 @@

    Create or modify variables +3,103 + + 373,935 @@ -7358,8 +7821,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -7399,11 +7862,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7433,6 +7900,9 @@

    Create or modify variables +7,148 + + 901,115 @@ -7462,6 +7932,9 @@

    Create or modify variables +1,102 + + 135,369 @@ -7487,8 +7960,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -7523,11 +7996,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7557,6 +8034,9 @@

    Create or modify variables +887 + + 117,917 @@ -7586,6 +8066,9 @@

    Create or modify variables +542 + + 64,856 @@ -7615,6 +8098,9 @@

    Create or modify variables +1,435 + + 170,271 @@ -7644,6 +8130,9 @@

    Create or modify variables +2,283 + + 309,506 @@ -7673,6 +8162,9 @@

    Create or modify variables +1,661 + + 206,866 @@ -7702,6 +8194,9 @@

    Create or modify variables +1,442 + + 167,069 @@ -7727,8 +8222,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -7745,11 +8240,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7779,6 +8278,9 @@

    Create or modify variables +887 + + 117,917 @@ -7808,6 +8310,9 @@

    Create or modify variables +542 + + 64,856 @@ -7837,6 +8342,9 @@

    Create or modify variables +3,718 + + 479,777 @@ -7866,6 +8374,9 @@

    Create or modify variables +3,103 + + 373,935 @@ -7891,8 +8402,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -7959,11 +8470,15 @@

    Create or modify variables + Level +n + + Number (000) @@ -7993,6 +8508,9 @@

    Create or modify variables +8,126 + + 1,016,202 @@ -8022,6 +8540,9 @@

    Create or modify variables +124 + + 20,282 @@ -8047,8 +8568,8 @@

    Create or modify variables - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -8065,7 +8586,7 @@

    Create or modify variables#> NULL # Rather, the new variable is here: str(surveytable:::env$survey$variables$newvar) -#> Factor w/ 42 levels "Blank : Under 15 years",..: 17 31 24 38 38 24 30 31 24 38 ... +#> Factor w/ 42 levels "Blank: Under 15 years",..: 17 31 24 38 38 24 30 31 24 38 ... #> - attr(*, "label")= chr "(Major reason for this visit) x (Patient age recode)"
    @@ -8096,11 +8617,15 @@

    Save the output + Level +n + + Number (000) @@ -8130,6 +8655,9 @@

    Save the output +7,498 + + 980,280 @@ -8159,6 +8687,9 @@

    Save the output +752 + + 56,204 @@ -8184,8 +8715,8 @@

    Save the output - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -8202,11 +8733,15 @@

    Save the output + Level +n + + Number (000) @@ -8236,6 +8771,9 @@

    Save the output +2,993 + + 521,466 @@ -8265,6 +8803,9 @@

    Save the output +3,050 + + 214,832 @@ -8294,6 +8835,9 @@

    Save the output +2,207 + + 300,186 @@ -8319,8 +8863,8 @@

    Save the output - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. @@ -8338,11 +8882,15 @@

    Save the output + Level +n + + Number (000) @@ -8372,6 +8920,9 @@

    Save the output +7,496 + + 973,676 @@ -8401,6 +8952,9 @@

    Save the output +754 + + 62,809 @@ -8426,8 +8980,8 @@

    Save the output - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. diff --git a/docs/index.html b/docs/index.html index fa93ae5..79b8755 100644 --- a/docs/index.html +++ b/docs/index.html @@ -158,11 +158,15 @@

    Example + Level +n + + Number (000) @@ -192,6 +196,9 @@

    Example +887 + + 117,917 @@ -221,6 +228,9 @@

    Example +542 + + 64,856 @@ -250,6 +260,9 @@

    Example +1,435 + + 170,271 @@ -279,6 +292,9 @@

    Example +2,283 + + 309,506 @@ -308,6 +324,9 @@

    Example +1,661 + + 206,866 @@ -337,6 +356,9 @@

    Example +1,442 + + 167,069 @@ -362,8 +384,8 @@

    Example - -(Checked presentation standards. Nothing to report.) + +N = 8250. Checked NCHS presentation standards. Nothing to report. diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index abb5405..28ff896 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables: Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html surveytable: surveytable.html -last_built: 2024-02-29T23:40Z +last_built: 2024-03-11T15:08Z urls: reference: https://cdcgov.github.io/surveytable/reference article: https://cdcgov.github.io/surveytable/articles diff --git a/docs/reference/print.surveytable_table.html b/docs/reference/print.surveytable_table.html index 862e36c..3c27e57 100644 --- a/docs/reference/print.surveytable_table.html +++ b/docs/reference/print.surveytable_table.html @@ -101,68 +101,77 @@

    Examples#> table1 = tab("AGER") print(table1) -#> Patient age recode {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> table_many = tab("MDDO", "SPECCAT", "MSA") print(table_many) -#> Type of doctor (MD or DO) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ M.D. - Doctor │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ -#> │ of Medicine │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ D.O. - Doctor │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ -#> │ of Osteopathy │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Type of doctor (MD or DO) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ M.D. - │ 7,498 │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ +#> │ Doctor of │ │ │ │ │ │ │ │ │ │ +#> │ Medicine │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ D.O. - │ 752 │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ +#> │ Doctor of │ │ │ │ │ │ │ │ │ │ +#> │ Osteopathy │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> -#> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Primary care │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Surgical care │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Medical care │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Primary │ 2,993 │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Surgical │ 3,050 │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Medical │ 2,207 │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> -#> Metropolitan Statistical Area Status of physician location {NAMCS 2019 -#> PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ MSA │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ -#> │ (Metropolitan │ │ │ │ │ │ │ │ │ -#> │ Statistical │ │ │ │ │ │ │ │ │ -#> │ Area) │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ Non-MSA │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ -#> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Metropolitan Statistical Area Status of physician location {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ MSA │ 7,496 │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ +#> │ (Metropolit │ │ │ │ │ │ │ │ │ │ +#> │ an │ │ │ │ │ │ │ │ │ │ +#> │ Statistical │ │ │ │ │ │ │ │ │ │ +#> │ Area) │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ Non-MSA │ 754 │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #>

    diff --git a/docs/reference/set_count_1k.html b/docs/reference/set_count_1k.html index a5982d5..9a007cf 100644 --- a/docs/reference/set_count_1k.html +++ b/docs/reference/set_count_1k.html @@ -104,27 +104,26 @@

    Examples#> * Rounding counts to the nearest integer. #> * ?set_count_int for other options. total() -#> Total {NAMCS 2019 PUF} -#> ┌───────────────┬────────────┬─────────────┬───────────────┐ -#> │ Number │ SE │ LL │ UL │ -#> ├───────────────┼────────────┼─────────────┼───────────────┤ -#> │ 1,036,484,356 │ 48,836,217 │ 945,013,590 │ 1,136,808,860 │ -#> └───────────────┴────────────┴─────────────┴───────────────┘ -#> (Checked presentation standards. Nothing to -#> report.) +#> Total {NAMCS 2019 PUF} +#> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ +#> │ n │ Number │ SE │ LL │ UL │ +#> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ +#> │ 8,250 │ 1,036,484,356 │ 48,836,217 │ 945,013,590 │ 1,136,808,860 │ +#> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> set_count_1k() #> * Rounding counts to the nearest 1,000. #> * ?set_count_1k for other options. total() -#> Total {NAMCS 2019 PUF} -#> ┌───────────────┬───────────────┬───────────────┬───────────────┐ -#> │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ -#> ├───────────────┼───────────────┼───────────────┼───────────────┤ -#> │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ -#> └───────────────┴───────────────┴───────────────┴───────────────┘ -#> (Checked presentation standards. Nothing to report.) +#> Total {NAMCS 2019 PUF} +#> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ +#> │ n │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ +#> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ +#> │ 8,250 │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ +#> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/set_output.html b/docs/reference/set_output.html index a181ade..0d43991 100644 --- a/docs/reference/set_output.html +++ b/docs/reference/set_output.html @@ -98,25 +98,26 @@

    Examples
    tmp_file = tempfile(fileext = ".csv")
     suppressMessages( set_output(csv = tmp_file) )
     tab("AGER")
    -#>                               Patient age recode {NAMCS 2019 PUF}                              
    -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐
    -#> │ Level         │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │  SE │   LL │   UL │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ Under 15      │      117,917 │   14,097 │   93,229 │  149,142 │    11.4 │ 1.3 │  8.9 │ 14.2 │
    -#> │ years         │              │          │          │          │         │     │      │      │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ 15-24 years   │       64,856 │    7,018 │   52,387 │   80,292 │     6.3 │ 0.6 │  5.1 │  7.5 │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ 25-44 years   │      170,271 │   13,966 │  144,925 │  200,049 │    16.4 │ 1.1 │ 14.3 │ 18.8 │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ 45-64 years   │      309,506 │   23,290 │  266,994 │  358,787 │    29.9 │ 1.4 │ 27.2 │ 32.6 │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ 65-74 years   │      206,866 │   14,366 │  180,481 │  237,109 │    20   │ 1.2 │ 17.6 │ 22.5 │
    -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    -#> │ 75 years and  │      167,069 │   15,179 │  139,746 │  199,735 │    16.1 │ 1.3 │ 13.7 │ 18.8 │
    -#> │ over          │              │          │          │          │         │     │      │      │
    -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘
    -#>   (Checked presentation standards. Nothing to report.)                                         
    +#>                                 Patient age recode {NAMCS 2019 PUF}                                 
    +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐
    +#> │ Level       │     n │      Number │ SE (000) │ LL (000) │ UL (000) │ Percent │  SE │   LL │   UL │
    +#> │             │       │       (000) │          │          │          │         │     │      │      │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ Under 15    │   887 │     117,917 │   14,097 │   93,229 │  149,142 │    11.4 │ 1.3 │  8.9 │ 14.2 │
    +#> │ years       │       │             │          │          │          │         │     │      │      │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ 15-24 years │   542 │      64,856 │    7,018 │   52,387 │   80,292 │     6.3 │ 0.6 │  5.1 │  7.5 │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ 25-44 years │ 1,435 │     170,271 │   13,966 │  144,925 │  200,049 │    16.4 │ 1.1 │ 14.3 │ 18.8 │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ 45-64 years │ 2,283 │     309,506 │   23,290 │  266,994 │  358,787 │    29.9 │ 1.4 │ 27.2 │ 32.6 │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ 65-74 years │ 1,661 │     206,866 │   14,366 │  180,481 │  237,109 │    20   │ 1.2 │ 17.6 │ 22.5 │
    +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤
    +#> │ 75 years    │ 1,442 │     167,069 │   15,179 │  139,746 │  199,735 │    16.1 │ 1.3 │ 13.7 │ 18.8 │
    +#> │ and over    │       │             │          │          │          │         │     │      │      │
    +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘
    +#>   N = 8250. Checked NCHS presentation standards. Nothing to report.                                 
     #> 
     set_output(csv = "") # Turn off CSV output
     #> * Turning off CSV output.
    diff --git a/docs/reference/set_survey.html b/docs/reference/set_survey.html
    index 2f9f66b..f149a6f 100644
    --- a/docs/reference/set_survey.html
    +++ b/docs/reference/set_survey.html
    @@ -90,11 +90,11 @@ 

    Value

    Details

    opts:

    • "nchs":

      • Round counts to the nearest 1,000 -- see set_count_1k().

      • -
      • Identify low-precision estimates (surveytable.check_present option).

      • +
      • Identify low-precision estimates (surveytable.find_lpe option).

      • Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation (surveytable.adjust_svyciprop option).

    • "general":

      • Round counts to the nearest integer -- see set_count_int().

      • -
      • Do not look for low-precision estimates (surveytable.check_present option).

      • +
      • Do not look for low-precision estimates (surveytable.find_lpe option).

      • Percentage CI's: use standard Korn-Graubard CI's.

    Optionally, the survey can have an attribute called label, which is the diff --git a/docs/reference/show_options.html b/docs/reference/show_options.html index f3a77f0..8558ed1 100644 --- a/docs/reference/show_options.html +++ b/docs/reference/show_options.html @@ -92,20 +92,20 @@

    Examples#> $surveytable.adjust_svyciprop.df_method #> [1] "NHIS" #> -#> $surveytable.check_present -#> [1] TRUE -#> #> $surveytable.csv #> [1] "" #> #> $surveytable.drop_na #> [1] FALSE #> +#> $surveytable.find_lpe +#> [1] TRUE +#> #> $surveytable.max_levels #> [1] 20 #> #> $surveytable.names_count -#> [1] "Number (000)" "SE (000)" "LL (000)" "UL (000)" +#> [1] "n" "Number (000)" "SE (000)" "LL (000)" "UL (000)" #> #> $surveytable.names_prct #> [1] "Percent" "SE" "LL" "UL" diff --git a/docs/reference/survey_subset.html b/docs/reference/survey_subset.html index 683cb95..b544888 100644 --- a/docs/reference/survey_subset.html +++ b/docs/reference/survey_subset.html @@ -100,16 +100,17 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab("AGER") -#> Patient age recode {Children < 18} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 86.1 │ 1.6 │ 82.6 │ 89.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 19,004 │ 2,872 │ 14,051 │ 25,702 │ 13.9 │ 1.6 │ 10.8 │ 17.4 │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {Children < 18} +#> ┌─────────────┬─────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼─────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 86.1 │ 1.6 │ 82.6 │ 89.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼─────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 179 │ 19,004 │ 2,872 │ 14,051 │ 25,702 │ 13.9 │ 1.6 │ 10.8 │ 17.4 │ +#> └─────────────┴─────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 1066. Checked NCHS presentation standards. Nothing to report. #>

    diff --git a/docs/reference/svyciprop_adjusted.html b/docs/reference/svyciprop_adjusted.html index 78a7830..261a70e 100644 --- a/docs/reference/svyciprop_adjusted.html +++ b/docs/reference/svyciprop_adjusted.html @@ -126,25 +126,26 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab("AGER") -#> Patient age recode {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/tab.html b/docs/reference/tab.html index ab3cb82..b863424 100644 --- a/docs/reference/tab.html +++ b/docs/reference/tab.html @@ -144,67 +144,76 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab("AGER") -#> Patient age recode {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> tab("MDDO", "SPECCAT", "MSA") -#> Type of doctor (MD or DO) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ M.D. - Doctor │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ -#> │ of Medicine │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ D.O. - Doctor │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ -#> │ of Osteopathy │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Type of doctor (MD or DO) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ M.D. - │ 7,498 │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ +#> │ Doctor of │ │ │ │ │ │ │ │ │ │ +#> │ Medicine │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ D.O. - │ 752 │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ +#> │ Doctor of │ │ │ │ │ │ │ │ │ │ +#> │ Osteopathy │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> -#> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Primary care │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Surgical care │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Medical care │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ -#> │ specialty │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Primary │ 2,993 │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Surgical │ 3,050 │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Medical │ 2,207 │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ +#> │ care │ │ │ │ │ │ │ │ │ │ +#> │ specialty │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> -#> Metropolitan Statistical Area Status of physician location {NAMCS 2019 -#> PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ MSA │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ -#> │ (Metropolitan │ │ │ │ │ │ │ │ │ -#> │ Statistical │ │ │ │ │ │ │ │ │ -#> │ Area) │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ Non-MSA │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ -#> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Metropolitan Statistical Area Status of physician location {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ MSA │ 7,496 │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ +#> │ (Metropolit │ │ │ │ │ │ │ │ │ │ +#> │ an │ │ │ │ │ │ │ │ │ │ +#> │ Statistical │ │ │ │ │ │ │ │ │ │ +#> │ Area) │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ Non-MSA │ 754 │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> # Numeric variables @@ -219,25 +228,26 @@

    Examples # Hypothesis testing with categorical variables tab("AGER", test = TRUE) -#> Patient age recode {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Comparison of all possible pairs of Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ diff --git a/docs/reference/tab_rate.html b/docs/reference/tab_rate.html index 012c5a6..3141577 100644 --- a/docs/reference/tab_rate.html +++ b/docs/reference/tab_rate.html @@ -132,34 +132,33 @@

    Examples#> # pop is a data frame tab_rate("MSA", uspop2019$MSA) -#> Metropolitan Statistical Area Status of physician location (rate per -#> 100 population) {NAMCS 2019 PUF} -#> ┌────────────────────────────┬───────┬──────┬───────┬───────┐ -#> │ Level │ Rate │ SE │ LL │ UL │ -#> ├────────────────────────────┼───────┼──────┼───────┼───────┤ -#> │ MSA (Metropolitan │ 351.2 │ 18.2 │ 317.2 │ 388.8 │ -#> │ Statistical Area) │ │ │ │ │ -#> ├────────────────────────────┼───────┼──────┼───────┼───────┤ -#> │ Non-MSA │ 136.7 │ 38.2 │ 78.9 │ 236.8 │ -#> └────────────────────────────┴───────┴──────┴───────┴───────┘ -#> (Checked presentation standards. Nothing to -#> report.) +#> Metropolitan Statistical Area Status of physician location (rate per 100 population) {NAMCS 2019 PUF} +#> ┌───────────────────────┬───────┬───────┬──────┬───────┬───────┐ +#> │ Level │ n │ Rate │ SE │ LL │ UL │ +#> ├───────────────────────┼───────┼───────┼──────┼───────┼───────┤ +#> │ MSA (Metropolitan │ 7,496 │ 351.2 │ 18.2 │ 317.2 │ 388.8 │ +#> │ Statistical Area) │ │ │ │ │ │ +#> ├───────────────────────┼───────┼───────┼──────┼───────┼───────┤ +#> │ Non-MSA │ 754 │ 136.7 │ 38.2 │ 78.9 │ 236.8 │ +#> └───────────────────────┴───────┴───────┴──────┴───────┴───────┘ +#> N = 8250. Checked NCHS presentation +#> standards. Nothing to report. #> # pop is a single number tab_rate("MDDO", uspop2019$total) #> * Rate based on the entire population. -#> Type of doctor (MD or DO) (rate per 100 population) {NAMCS 2019 PUF} -#> ┌────────────────────────────┬───────┬────┬───────┬───────┐ -#> │ Level │ Rate │ SE │ LL │ UL │ -#> ├────────────────────────────┼───────┼────┼───────┼───────┤ -#> │ M.D. - Doctor of Medicine │ 303.3 │ 15 │ 275.3 │ 334.1 │ -#> ├────────────────────────────┼───────┼────┼───────┼───────┤ -#> │ D.O. - Doctor of │ 17.4 │ 2 │ 13.8 │ 21.9 │ -#> │ Osteopathy │ │ │ │ │ -#> └────────────────────────────┴───────┴────┴───────┴───────┘ -#> (Checked presentation standards. Nothing to -#> report.) +#> Type of doctor (MD or DO) (rate per 100 population) {NAMCS 2019 PUF} +#> ┌───────────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ +#> │ Level │ n │ Rate │ SE │ LL │ UL │ +#> ├───────────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ M.D. - Doctor of │ 7,498 │ 303.3 │ 15 │ 275.3 │ 334.1 │ +#> │ Medicine │ │ │ │ │ │ +#> ├───────────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ D.O. - Doctor of │ 752 │ 17.4 │ 2 │ 13.8 │ 21.9 │ +#> │ Osteopathy │ │ │ │ │ │ +#> └───────────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/tab_subset.html b/docs/reference/tab_subset.html index 89b4129..5b44aa3 100644 --- a/docs/reference/tab_subset.html +++ b/docs/reference/tab_subset.html @@ -163,97 +163,105 @@

    Examples # For each SEX, tabulate AGER tab_subset("AGER", "SEX") -#> Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 9.9 │ 1.2 │ 7.6 │ 12.6 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 6.8 │ 0.7 │ 5.4 │ 8.4 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 18.8 │ 1.6 │ 15.8 │ 22.1 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 29.1 │ 1.7 │ 25.8 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 19.8 │ 1.5 │ 17   │ 22.9 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 15.6 │ 1.5 │ 12.8 │ 18.7 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 9.9 │ 1.2 │ 7.6 │ 12.6 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 6.8 │ 0.7 │ 5.4 │ 8.4 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 18.8 │ 1.6 │ 15.8 │ 22.1 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 29.1 │ 1.7 │ 25.8 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 19.8 │ 1.5 │ 17   │ 22.9 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 15.6 │ 1.5 │ 12.8 │ 18.7 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 4609. Checked NCHS presentation standards. Nothing to report. #> -#> Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 13.4 │ 1.7 │ 10.3 │ 17.1 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 5.5 │ 0.8 │ 4   │ 7.3 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 13.1 │ 1.3 │ 10.7 │ 15.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 30.9 │ 1.6 │ 27.8 │ 34.3 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 20.1 │ 1.5 │ 17.3 │ 23.1 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 16.9 │ 1.5 │ 14   │ 20.2 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 13.4 │ 1.7 │ 10.3 │ 17.1 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 5.5 │ 0.8 │ 4   │ 7.3 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 13.1 │ 1.3 │ 10.7 │ 15.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 30.9 │ 1.6 │ 27.8 │ 34.3 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 20.1 │ 1.5 │ 17.3 │ 23.1 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 16.9 │ 1.5 │ 14   │ 20.2 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 3641. Checked NCHS presentation standards. Nothing to report. #> # Same counts as tab_subset(), but different percentages. tab_cross("AGER", "SEX") -#> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ -#> │ years : │ │ │ │ │ │ │ │ │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years : │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years : │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years : │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years : │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ -#> │ over : Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ -#> │ years : Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years : │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years : │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years : │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years : │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ -#> │ over : Male │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ +#> │ and over: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ +#> │ and over: │ │ │ │ │ │ │ │ │ │ +#> │ Male │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> # Numeric variables tab_subset("NUMMED", "AGER") -#> Number of medications coded (for different levels of Patient age -#> recode) {NAMCS 2019 PUF} +#> Number of medications coded (for different levels of Patient age recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ @@ -273,8 +281,7 @@

    Examples # Hypothesis testing tab_subset("NUMMED", "AGER", test = TRUE) -#> Number of medications coded (for different levels of Patient age -#> recode) {NAMCS 2019 PUF} +#> Number of medications coded (for different levels of Patient age recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ @@ -291,8 +298,7 @@

    Examples#> │ 75 years and over │ 100 │ 5.53 │ 0.494 │ 5.59 │ #> └───────────────────┴─────────┴──────┴───────┴──────┘ #> -#> Association between Number of medications coded and Patient age recode -#> {NAMCS 2019 PUF} +#> Association between Number of medications coded and Patient age recode {NAMCS 2019 PUF} #> ┌─────────────────┬─────────────────┐ #> │ p-value │ Flag │ #> ├─────────────────┼─────────────────┤ @@ -300,8 +306,7 @@

    Examples#> └─────────────────┴─────────────────┘ #> Wald test. *: p-value <= 0.05 #> -#> Comparison of Number of medications coded across all possible pairs of -#> Patient age recode {NAMCS 2019 PUF} +#> Comparison of Number of medications coded across all possible pairs of Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ #> │ Level 1 │ Level 2 │ p-value │ Flag │ #> ├────────────────┼───────────────────┼─────────┼──────┤ diff --git a/docs/reference/tab_subset_rate.html b/docs/reference/tab_subset_rate.html index 0a74b0b..8908d96 100644 --- a/docs/reference/tab_subset_rate.html +++ b/docs/reference/tab_subset_rate.html @@ -143,43 +143,41 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab_subset_rate("AGER", "SEX", uspop2019$`AGER x SEX`) -#> Patient age recode (Patient sex = Female) (rate per 100 population) -#> {NAMCS 2019 PUF} -#> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ -#> │ Level │ Rate │ SE │ LL │ UL │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ Under 15 years │ 202.5 │ 24.3 │ 159.8 │ 256.6 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 15-24 years │ 198.4 │ 21.9 │ 159.5 │ 246.8 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 25-44 years │ 263.3 │ 26.5 │ 215.9 │ 321   │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 45-64 years │ 414   │ 37.7 │ 346.2 │ 495.1 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 65-74 years │ 720.3 │ 66.4 │ 600.8 │ 863.6 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 75 years and over │ 758.1 │ 89.2 │ 601.2 │ 956   │ -#> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} +#> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ +#> │ Level │ n │ Rate │ SE │ LL │ UL │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ Under 15 years │ 434 │ 202.5 │ 24.3 │ 159.8 │ 256.6 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 15-24 years │ 346 │ 198.4 │ 21.9 │ 159.5 │ 246.8 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 25-44 years │ 923 │ 263.3 │ 26.5 │ 215.9 │ 321   │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 45-64 years │ 1,253 │ 414   │ 37.7 │ 346.2 │ 495.1 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 65-74 years │ 891 │ 720.3 │ 66.4 │ 600.8 │ 863.6 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 75 years and over │ 762 │ 758.1 │ 89.2 │ 601.2 │ 956   │ +#> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ +#> N = 4609. Checked NCHS presentation standards. Nothing to report. #> -#> Patient age recode (Patient sex = Male) (rate per 100 population) -#> {NAMCS 2019 PUF} -#> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ -#> │ Level │ Rate │ SE │ LL │ UL │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ Under 15 years │ 187.4 │ 25   │ 144.1 │ 243.7 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 15-24 years │ 113.1 │ 20.7 │ 78.4 │ 163   │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 25-44 years │ 133.4 │ 17.2 │ 103.4 │ 172   │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 45-64 years │ 333.4 │ 32.3 │ 275.4 │ 403.5 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 65-74 years │ 594.8 │ 46.4 │ 510.1 │ 693.6 │ -#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ -#> │ 75 years and over │ 801.2 │ 73.2 │ 669.1 │ 959.5 │ -#> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF} +#> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ +#> │ Level │ n │ Rate │ SE │ LL │ UL │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ Under 15 years │ 453 │ 187.4 │ 25   │ 144.1 │ 243.7 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 15-24 years │ 196 │ 113.1 │ 20.7 │ 78.4 │ 163   │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 25-44 years │ 512 │ 133.4 │ 17.2 │ 103.4 │ 172   │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 45-64 years │ 1,030 │ 333.4 │ 32.3 │ 275.4 │ 403.5 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 65-74 years │ 770 │ 594.8 │ 46.4 │ 510.1 │ 693.6 │ +#> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ +#> │ 75 years and over │ 680 │ 801.2 │ 73.2 │ 669.1 │ 959.5 │ +#> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ +#> N = 3641. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/total.html b/docs/reference/total.html index 5f9c194..d8f01a6 100644 --- a/docs/reference/total.html +++ b/docs/reference/total.html @@ -101,13 +101,13 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total() -#> Total {NAMCS 2019 PUF} -#> ┌───────────────┬───────────────┬───────────────┬───────────────┐ -#> │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ -#> ├───────────────┼───────────────┼───────────────┼───────────────┤ -#> │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ -#> └───────────────┴───────────────┴───────────────┴───────────────┘ -#> (Checked presentation standards. Nothing to report.) +#> Total {NAMCS 2019 PUF} +#> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ +#> │ n │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ +#> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ +#> │ 8,250 │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ +#> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/total_rate.html b/docs/reference/total_rate.html index c6159ca..633fda8 100644 --- a/docs/reference/total_rate.html +++ b/docs/reference/total_rate.html @@ -113,13 +113,13 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total_rate(uspop2019$total) -#> Total (rate per 100 population) {NAMCS 2019 PUF} -#> ┌───────────────┬───────────────┬───────────────┬───────────────┐ -#> │ Rate │ SE │ LL │ UL │ -#> ├───────────────┼───────────────┼───────────────┼───────────────┤ -#> │ 320.7 │ 15.1 │ 292.4 │ 351.7 │ -#> └───────────────┴───────────────┴───────────────┴───────────────┘ -#> (Checked presentation standards. Nothing to report.) +#> Total (rate per 100 population) {NAMCS 2019 PUF} +#> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ +#> │ n │ Rate │ SE │ LL │ UL │ +#> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ +#> │ 8,250 │ 320.7 │ 15.1 │ 292.4 │ 351.7 │ +#> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/var_all.html b/docs/reference/var_all.html index 9315575..1a68a6a 100644 --- a/docs/reference/var_all.html +++ b/docs/reference/var_all.html @@ -111,15 +111,17 @@

    Examples#> var_all("Medicare and Medicaid", c("PAYMCARE", "PAYMCAID")) tab("Medicare and Medicaid") -#> Medicare and Medicaid {NAMCS 2019 PUF} -#> ┌───────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ FALSE │ 1,016,202 │ 47,395 │ 927,389 │ 1,113,520 │ 98 │ 0.5 │ 96.9 │ 98.9 │ -#> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ TRUE │ 20,282 │ 5,177 │ 12,120 │ 33,941 │ 2 │ 0.5 │ 1.1 │ 3.1 │ -#> └───────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Medicare and Medicaid {NAMCS 2019 PUF} +#> ┌───────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ FALSE │ 8,126 │ 1,016,202 │ 47,395 │ 927,389 │ 1,113,520 │ 98 │ 0.5 │ 96.9 │ 98.9 │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ TRUE │ 124 │ 20,282 │ 5,177 │ 12,120 │ 33,941 │ 2 │ 0.5 │ 1.1 │ 3.1 │ +#> └───────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to +#> report. #> diff --git a/docs/reference/var_any.html b/docs/reference/var_any.html index debae77..34b7981 100644 --- a/docs/reference/var_any.html +++ b/docs/reference/var_any.html @@ -113,15 +113,17 @@

    Examples, c("ANYIMAGE", "BONEDENS", "CATSCAN", "ECHOCARD", "OTHULTRA" , "MAMMO", "MRI", "XRAY", "OTHIMAGE")) tab("Imaging services") -#> Imaging services {NAMCS 2019 PUF} -#> ┌───────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ FALSE │ 901,115 │ 43,298 │ 820,085 │ 990,151 │ 86.9 │ 1.1 │ 84.6 │ 89.1 │ -#> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ TRUE │ 135,369 │ 13,574 │ 111,134 │ 164,890 │ 13.1 │ 1.1 │ 10.9 │ 15.4 │ -#> └───────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Imaging services {NAMCS 2019 PUF} +#> ┌───────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ FALSE │ 7,148 │ 901,115 │ 43,298 │ 820,085 │ 990,151 │ 86.9 │ 1.1 │ 84.6 │ 89.1 │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ TRUE │ 1,102 │ 135,369 │ 13,574 │ 111,134 │ 164,890 │ 13.1 │ 1.1 │ 10.9 │ 15.4 │ +#> └───────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to +#> report. #> diff --git a/docs/reference/var_case.html b/docs/reference/var_case.html index 471c325..12b960d 100644 --- a/docs/reference/var_case.html +++ b/docs/reference/var_case.html @@ -112,29 +112,33 @@

    Examples#> var_case("Preventive care visits", "MAJOR", "Preventive care") tab("Preventive care visits") -#> Preventive care visits {NAMCS 2019 PUF} -#> ┌───────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ FALSE │ 812,861 │ 45,220 │ 728,841 │ 906,566 │ 78.4 │ 1.7 │ 74.9 │ 81.7 │ -#> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ TRUE │ 223,624 │ 18,520 │ 190,068 │ 263,103 │ 21.6 │ 1.7 │ 18.3 │ 25.1 │ -#> └───────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Preventive care visits {NAMCS 2019 PUF} +#> ┌───────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ FALSE │ 6,682 │ 812,861 │ 45,220 │ 728,841 │ 906,566 │ 78.4 │ 1.7 │ 74.9 │ 81.7 │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ TRUE │ 1,568 │ 223,624 │ 18,520 │ 190,068 │ 263,103 │ 21.6 │ 1.7 │ 18.3 │ 25.1 │ +#> └───────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to +#> report. #> var_case("Surgery-related visits" , "MAJOR" , c("Pre-surgery", "Post-surgery")) tab("Surgery-related visits") -#> Surgery-related visits {NAMCS 2019 PUF} -#> ┌───────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ FALSE │ 969,451 │ 47,976 │ 879,793 │ 1,068,246 │ 93.5 │ 0.8 │ 91.9 │ 94.9 │ -#> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ -#> │ TRUE │ 67,034 │ 7,810 │ 53,273 │ 84,348 │ 6.5 │ 0.8 │ 5.1 │ 8.1 │ -#> └───────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Surgery-related visits {NAMCS 2019 PUF} +#> ┌───────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ FALSE │ 7,432 │ 969,451 │ 47,976 │ 879,793 │ 1,068,246 │ 93.5 │ 0.8 │ 91.9 │ 94.9 │ +#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ +#> │ TRUE │ 818 │ 67,034 │ 7,810 │ 53,273 │ 84,348 │ 6.5 │ 0.8 │ 5.1 │ 8.1 │ +#> └───────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to +#> report. #> diff --git a/docs/reference/var_collapse.html b/docs/reference/var_collapse.html index 0ba2276..ec80c9f 100644 --- a/docs/reference/var_collapse.html +++ b/docs/reference/var_collapse.html @@ -111,35 +111,37 @@

    Examples#> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab("PRIMCARE") -#> Are you the patient's primary care provider? {NAMCS 2019 PUF} -#> ┌─────────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┬───────┐ -#> │ Level │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ Flags │ -#> │ │ (000) │ │ │ │ │ │ │ │ │ -#> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ -#> │ Blank │ 1,150 │ 478 │ 440 │ 3,005 │ 0.1 │ 0   │ 0   │ 0.2 │ Cx │ -#> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ -#> │ Unknown │ 39,519 │ 9,507 │ 24,520 │ 63,692 │ 3.8 │ 0.9 │ 2.3 │ 6   │ │ -#> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ -#> │ Yes │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ │ -#> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ -#> │ No │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ │ -#> └─────────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┴───────┘ -#> Cx: suppress count (and rate) +#> Are you the patient's primary care provider? {NAMCS 2019 PUF} +#> ┌─────────┬───────┬────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┬───────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ Flags │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ │ +#> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ +#> │ Blank │ 16 │ 1,150 │ 478 │ 440 │ 3,005 │ 0.1 │ 0   │ 0   │ 0.2 │ Cx │ +#> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ +#> │ Unknown │ 300 │ 39,519 │ 9,507 │ 24,520 │ 63,692 │ 3.8 │ 0.9 │ 2.3 │ 6   │ │ +#> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ +#> │ Yes │ 2,278 │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ │ +#> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ +#> │ No │ 5,656 │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ │ +#> └─────────┴───────┴────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┴───────┘ +#> N = 8250. Checked NCHS presentation standards: Cx: suppress count +#> (and rate). #> var_collapse("PRIMCARE", "Unknown if PCP", c("Blank", "Unknown")) tab("PRIMCARE") -#> Are you the patient's primary care provider? {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Unknown if │ 40,669 │ 9,479 │ 25,619 │ 64,560 │ 3.9 │ 0.9 │ 2.4 │ 6.1 │ -#> │ PCP │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Yes │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ No │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Are you the patient's primary care provider? {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Unknown if │ 316 │ 40,669 │ 9,479 │ 25,619 │ 64,560 │ 3.9 │ 0.9 │ 2.4 │ 6.1 │ +#> │ PCP │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Yes │ 2,278 │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ No │ 5,656 │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/var_copy.html b/docs/reference/var_copy.html index 86095be..4217635 100644 --- a/docs/reference/var_copy.html +++ b/docs/reference/var_copy.html @@ -113,40 +113,42 @@

    Examplesvar_collapse("Age group", "65+", c("65-74 years", "75 years and over")) var_collapse("Age group", "25-64", c("25-44 years", "45-64 years")) tab("AGER", "Age group") -#> Patient age recode {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ -#> │ over │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Patient age recode {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ +#> │ and over │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> -#> Age group {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ -#> │ years │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-64 │ 479,777 │ 32,175 │ 420,624 │ 547,247 │ 46.3 │ 1.8 │ 42.7 │ 49.9 │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65+ │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Age group {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ +#> │ years │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-64 │ 3,718 │ 479,777 │ 32,175 │ 420,624 │ 547,247 │ 46.3 │ 1.8 │ 42.7 │ 49.9 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65+ │ 3,103 │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/var_cross.html b/docs/reference/var_cross.html index b01c33c..7c2b890 100644 --- a/docs/reference/var_cross.html +++ b/docs/reference/var_cross.html @@ -115,48 +115,55 @@

    Examples#> var_cross("Age x Sex", "AGER", "SEX") tab("Age x Sex") -#> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} -#> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ -#> │ years : │ │ │ │ │ │ │ │ │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years : │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years : │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years : │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years : │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ -#> │ Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ -#> │ over : Female │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ -#> │ years : Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-24 years : │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 25-44 years : │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 45-64 years : │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65-74 years : │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ -#> │ Male │ │ │ │ │ │ │ │ │ -#> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ -#> │ over : Male │ │ │ │ │ │ │ │ │ -#> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ +#> │ years: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ +#> │ and over: │ │ │ │ │ │ │ │ │ │ +#> │ Female │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-24 │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 25-44 │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 45-64 │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65-74 │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ +#> │ years: Male │ │ │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ +#> │ and over: │ │ │ │ │ │ │ │ │ │ +#> │ Male │ │ │ │ │ │ │ │ │ │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/reference/var_cut.html b/docs/reference/var_cut.html index 558a957..6620b01 100644 --- a/docs/reference/var_cut.html +++ b/docs/reference/var_cut.html @@ -119,21 +119,22 @@

    Examples, c(-Inf, 0, 4, 14, 64, Inf) , c("Under 1", "1-4", "5-14", "15-64", "65 and over")) tab("Age group") -#> Age group {NAMCS 2019 PUF} -#> ┌─────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ -#> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ -#> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ Under 1 │ 31,148 │ 5,282 │ 22,269 │ 43,566 │ 3   │ 0.5 │ 2.1 │ 4.1 │ -#> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 1-4 │ 38,240 │ 5,444 │ 28,864 │ 50,662 │ 3.7 │ 0.5 │ 2.7 │ 4.8 │ -#> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 5-14 │ 48,529 │ 5,741 │ 38,430 │ 61,282 │ 4.7 │ 0.5 │ 3.7 │ 5.9 │ -#> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 15-64 │ 544,632 │ 36,082 │ 478,254 │ 620,223 │ 52.5 │ 2   │ 48.6 │ 56.5 │ -#> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ -#> │ 65 and over │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ -#> └─────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ -#> (Checked presentation standards. Nothing to report.) +#> Age group {NAMCS 2019 PUF} +#> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ +#> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ +#> │ │ │ (000) │ │ │ │ │ │ │ │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ Under 1 │ 203 │ 31,148 │ 5,282 │ 22,269 │ 43,566 │ 3   │ 0.5 │ 2.1 │ 4.1 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 1-4 │ 281 │ 38,240 │ 5,444 │ 28,864 │ 50,662 │ 3.7 │ 0.5 │ 2.7 │ 4.8 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 5-14 │ 403 │ 48,529 │ 5,741 │ 38,430 │ 61,282 │ 4.7 │ 0.5 │ 3.7 │ 5.9 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 15-64 │ 4,260 │ 544,632 │ 36,082 │ 478,254 │ 620,223 │ 52.5 │ 2   │ 48.6 │ 56.5 │ +#> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ +#> │ 65 and over │ 3,103 │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ +#> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ +#> N = 8250. Checked NCHS presentation standards. Nothing to report. #> diff --git a/docs/search.json b/docs/search.json index 001d1d4..67d5b96 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"begin","dir":"Articles","previous_headings":"","what":"Begin","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"Begin loading surveytable package. , print message explaining specify survey ’d like analyze. omitting message . Now, specify survey ’d like analyze. Survey info {NAMCS 2019 PUF} Check survey name, survey design variables, number observations verify looks correct.","code":"library(surveytable) set_survey(namcs2019sv)"},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"counts-and-percentages","dir":"Articles","previous_headings":"Table 1","what":"Counts and percentages","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows overall estimated count well counts percentages type doctor, physician specialty, metropolitan statistical area. variables necessary creating table already survey, making commands straightforward. Total {NAMCS 2019 PUF} Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF}","code":"total() tab(\"MDDO\", \"SPECCAT\", \"MSA\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"rates","dir":"Articles","previous_headings":"Table 1","what":"Rates","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"published table also shows several rates. calculate rates, addition survey, need source information population estimates. typically use function read.csv() load population estimates get correct format. surveytable package comes object called uspop2019 contains several population estimates use examples. overall population estimate: overall population estimate, overall rate : Total (rate per 100 population) {NAMCS 2019 PUF} calculate rates particular variable, need provide data frame variable called Level matches levels variable survey, variable called Population gives population size (assumed constant rather random variable). MSA, can see levels variables just using tab() command, just . Thus, calculate rates, need data frame follows: Now appropriate population estimates, rate : Metropolitan Statistical Area Status physician location (rate per 100 population) {NAMCS 2019 PUF} can also calculate rates specific variable based entire population: Type doctor (MD ) (rate per 100 population) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) (rate per 100 population) {NAMCS 2019 PUF}","code":"class(uspop2019) ## [1] \"list\" names(uspop2019) ## [1] \"total\" \"MSA\" \"AGER\" \"Age group\" \"SEX\" ## [6] \"AGER x SEX\" \"Age group 5\" uspop2019$total ## [1] 323186697 total_rate(uspop2019$total) uspop2019$MSA ## Level Population ## 1 MSA (Metropolitan Statistical Area) 277229518 ## 2 Non-MSA 45957179 tab_rate(\"MSA\", uspop2019$MSA) tab_rate(\"MDDO\", uspop2019$total) ## * Rate based on the entire population. tab_rate(\"SPECCAT\", uspop2019$total) ## * Rate based on the entire population."},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"counts-and-percentages-1","dir":"Articles","previous_headings":"Table 3","what":"Counts and percentages","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table presents estimates age group, well age group sex. Variables beginning ‘age’ {NAMCS 2019 PUF} survey couple relevant age-related variables. AGE patient age years. AGER categorical variable based AGE. However, table, addition AGER, need another age group variable, different age categories. create using var_cut function. Now ’ve created Age group variable, can create tables: Patient age recode {NAMCS 2019 PUF} Age group {NAMCS 2019 PUF} Patient sex {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) {NAMCS 2019 PUF}","code":"var_list(\"age\") var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) tab(\"AGER\", \"Age group\", \"SEX\") tab_cross(\"AGER\", \"SEX\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"rates-1","dir":"Articles","previous_headings":"Table 3","what":"Rates","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"Patient age recode (rate per 100 population) {NAMCS 2019 PUF} Age group (rate per 100 population) {NAMCS 2019 PUF} Patient sex (rate per 100 population) {NAMCS 2019 PUF} calculate rates one variable (AGER) another variable (SEX), need population estimates following format: population estimates, rates : Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF}","code":"tab_rate(\"AGER\", uspop2019$AGER) tab_rate(\"Age group\", uspop2019$`Age group`) ## * Population for some levels not defined: 15-64 tab_rate(\"SEX\", uspop2019$SEX) uspop2019$`AGER x SEX` ## Level Subset Population ## 1 Under 15 years Female 29604762 ## 2 15-24 years Female 20730118 ## 3 25-44 years Female 43192143 ## 4 45-64 years Female 42508901 ## 5 65-74 years Female 16673240 ## 6 75 years and over Female 12421444 ## 7 Under 15 years Male 30921894 ## 8 15-24 years Male 20988582 ## 9 25-44 years Male 42407267 ## 10 45-64 years Male 40053148 ## 11 65-74 years Male 14586962 ## 12 75 years and over Male 9098236 tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`)"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-5","dir":"Articles","previous_headings":"","what":"Table 5","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table gives expected sources payment. use PAY* variables create several new variables required table. Note PAY* variables logical (TRUE FALSE), simplifies workflow. (survey imported R using importsurvey package, automatically detects binary variables imports logical variables.) Expected source payment visit: Private insurance {NAMCS 2019 PUF} Expected source payment visit: Medicare {NAMCS 2019 PUF} Expected source payment visit: Medicaid CHIP state-based program {NAMCS 2019 PUF} Medicare Medicaid {NAMCS 2019 PUF} insurance {NAMCS 2019 PUF} Self-pay {NAMCS 2019 PUF} charge {NAMCS 2019 PUF} Expected source payment visit: Workers Compensation {NAMCS 2019 PUF} Expected source payment visit: {NAMCS 2019 PUF} Unknown blank {NAMCS 2019 PUF} Check presentation standards flags! NCHS presentation standards rules, estimates shown.","code":"# var_all(\"Medicare and Medicaid\", c(\"PAYMCARE\", \"PAYMCAID\")) # var_any(\"Payment used\", c(\"PAYPRIV\", \"PAYMCARE\", \"PAYMCAID\" , \"PAYWKCMP\", \"PAYOTH\", \"PAYDK\")) var_not(\"No other payment used\", \"Payment used\") var_all(\"Self-pay\", c(\"PAYSELF\", \"No other payment used\")) var_all(\"No charge\", c(\"PAYNOCHG\", \"No other payment used\")) var_any(\"No insurance\", c(\"Self-pay\", \"No charge\")) # var_case(\"No pay\", \"NOPAY\", \"No categories marked\") var_any(\"Unknown or blank\", c(\"PAYDK\", \"No pay\")) ## tab(\"PAYPRIV\", \"PAYMCARE\", \"PAYMCAID\", \"Medicare and Medicaid\" , \"No insurance\", \"Self-pay\", \"No charge\" , \"PAYWKCMP\", \"PAYOTH\", \"Unknown or blank\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-6","dir":"Articles","previous_headings":"","what":"Table 6","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows primary care provider referral status, prior-visit status. table, “Unknown” “Blank” values collapsed single value. can collapse two levels factor single level using var_collapse function. Now, table: patient’s primary care provider? {NAMCS 2019 PUF} patient referred visit? {NAMCS 2019 PUF} patient seen practice ? {NAMCS 2019 PUF} percentages within subset defined SENBEFOR add 100% – reason, want use tab_subset(), tab_cross(). patient’s primary care provider? (patient seen practice ? = Yes, established patient) {NAMCS 2019 PUF} patient’s primary care provider? (patient seen practice ? = , new patient) {NAMCS 2019 PUF} patient referred visit? (patient seen practice ? = Yes, established patient) {NAMCS 2019 PUF} patient referred visit? (patient seen practice ? = , new patient) {NAMCS 2019 PUF}","code":"var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Unknown\", \"Blank\")) var_collapse(\"REFER\", \"Unknown if referred\", c(\"Unknown\", \"Blank\")) tab(\"PRIMCARE\", \"REFER\", \"SENBEFOR\") tab_subset(\"PRIMCARE\", \"SENBEFOR\") tab_subset(\"REFER\", \"SENBEFOR\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-11","dir":"Articles","previous_headings":"","what":"Table 11","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows information Table 3, preventive care visits. , estimates age group, well age group sex, preventive care visits. Let’s create Age group AGE cross AGER SEX create variable called Age x Sex: see possible values MAJOR (Major reason visit), estimate total count preventive care visits: Major reason visit {NAMCS 2019 PUF} create tables age, sex, interaction, limit preventive care visits: Patient age recode (Major reason visit = Preventive care) {NAMCS 2019 PUF} Age group (Major reason visit = Preventive care) {NAMCS 2019 PUF} Patient sex (Major reason visit = Preventive care) {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) (Major reason visit = Preventive care) {NAMCS 2019 PUF} commands similar, differs first variable passed tab_subset() function, code can streamlined loop: Patient age recode (Major reason visit = Preventive care) {NAMCS 2019 PUF} Age group (Major reason visit = Preventive care) {NAMCS 2019 PUF} Patient sex (Major reason visit = Preventive care) {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) (Major reason visit = Preventive care) {NAMCS 2019 PUF} Note called inside loop, print() function needs called explicitly.","code":"var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) ## Warning in var_cut(\"Age group\", \"AGE\", c(-Inf, 0, 4, 14, 64, Inf), c(\"Under 1\", ## : Age group: overwriting a variable that already exists. var_cross(\"Age x Sex\", \"AGER\", \"SEX\") tab(\"MAJOR\") tab_subset(\"AGER\", \"MAJOR\", \"Preventive care\") tab_subset(\"Age group\", \"MAJOR\", \"Preventive care\") tab_subset(\"SEX\", \"MAJOR\", \"Preventive care\") tab_subset(\"Age x Sex\", \"MAJOR\", \"Preventive care\") for (vr in c(\"AGER\", \"Age group\", \"SEX\", \"Age x Sex\")) { print( tab_subset(vr, \"MAJOR\", \"Preventive care\") ) }"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"more-advanced-coding","dir":"Articles","previous_headings":"Table 11","what":"More advanced coding","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"addition, age-sex category, published table shows percentage preventive care visits made primary care physicians. calculate percentages, slightly involved loop needed. code, followed explanation: Since tab_subset() called within loop, wanted print screen, need use print( tab_subset(*) ). Since don’t want print screen, call print() omitted. Since many tables produced, output sent CSV file. , loop goes age, sex, age / sex interaction variables, calling variables vr. MAJOR vr crossed, result stored variable called tmp. Next, inner loop goes levels vr, calling levels lvl. code tabulates SPECCAT (Type specialty – Primary, Medical, Surgical) subset tmp (MAJOR crossed vr) restricted “Preventive care:” followed lvl, level vr, “15 years” AGER. Finally, CSV output turned . run code, tables stored CSV file. give idea tables look like, just one tables: Type specialty (Primary, Medical, Surgical) ((Major reason visit) x (Patient age recode) = Preventive care : 15 years) {NAMCS 2019 PUF} match percentage published table, see “Primary care specialty” row. sure check presentation standards flags.","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) for (vr in c(\"AGER\", \"Age group\", \"SEX\", \"Age x Sex\")) { var_cross(\"tmp\", \"MAJOR\", vr) for (lvl in levels(surveytable:::env$survey$variables[,vr])) { tab_subset(\"SPECCAT\", \"tmp\", paste0(\"Preventive care : \", lvl)) } } ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. set_output(csv = \"\") ## * Turning off CSV output. ## * ?set_output for other options. vr = \"AGER\" var_cross(\"tmp\", \"MAJOR\", vr) ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. lvl = levels(surveytable:::env$survey$variables[,vr])[1] tab_subset(\"SPECCAT\", \"tmp\", paste0(\"Preventive care : \", lvl))"},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"concepts","dir":"Articles","previous_headings":"Preliminaries","what":"Concepts","title":"Introduction to surveytable","text":"two important concepts need learn distinguish: data frame standard way storing data R. data frame rectangular data. Variables columns, observations rows. Example: data frame, , represent complex survey. , just looking data frame, R know sampling weights , strata , etc. Even variables represent sampling weights, etc, part data frame, just looking data frame, R know variable represents weights survey design variables. can get data frame R many different ways. data currently comma-separated values (CSV) file, can use read.csv(). ’s SAS file, can use package like haven importsurvey. ’s already R format, use readRDS(), . survey object object describes survey. tells R sampling weights , strata , . data frame can converted survey object using survey::svydesign() function; survey uses replicate weights, survey::svrepdesign() function used. Generally speaking, need convert data frame survey object . converted, can save saveRDS() (similar). future, can load readRDS(). need re-convert data frame survey object every time.","code":"head(iris) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"namcs","dir":"Articles","previous_headings":"Preliminaries","what":"NAMCS","title":"Introduction to surveytable","text":"Examples tutorial use survey called National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF). NAMCS “annual nationally representative sample survey visits non-federal office-based patient care physicians, excluding anesthesiologists, radiologists, pathologists.” Note unit observation visits, patients – distinction important since single patient can make multiple visits. surveytable package comes data frame selected variables NAMCS, called namcs2019sv_df (sv = selected variables; df = data frame). survey object survey called namcs2019sv. namcs2019sv object analyze. really need namcs2019sv. reason package namcs2019sv_df illustrate convert data frame survey object.","code":""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"more-concepts","dir":"Articles","previous_headings":"Preliminaries","what":"More concepts","title":"Introduction to surveytable","text":"importing data another source, SAS CSV, analysts aware standard way variables handled R. Specifically, categorical variables stored factor. true / false variables stored factor well, programming tasks easier stored logical. Unknown values stored missing (NA). variable contains “special values”, negative value indicating age missing, “special values” need converted NA. Variables namcs2019sv_df already stored correctly. Thus, AGER (patient’s age group) factor variable; PAYNOCHG (indicates whether charge physician visit) logical variable; AGE (patient’s age years) numeric variable.","code":"library(\"surveytable\") class(namcs2019sv_df$AGER) #> [1] \"factor\" class(namcs2019sv_df$PAYNOCHG) #> [1] \"logical\" class(namcs2019sv_df$AGE) #> [1] \"numeric\""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"create-a-survey-object","dir":"Articles","previous_headings":"Preliminaries","what":"Create a survey object","title":"Introduction to surveytable","text":"seen , tables produced surveytable clearer either variable names descriptive, variables \"label\" attribute descriptive. namcs2019sv_df, variables already \"label\" attribute set. example, variable name AGE descriptive, variable descriptive \"label\" attribute: Documentation NAMCS survey provides names survey design variables. Specifically, NAMCS, cluster ID’s, also known primary sampling units (PSU’s), given CPSUM; strata given CSTRATM; sampling weights given PATWT. Thus, namcs2019sv_df data frame can turned survey object follows: Tables produced surveytable clearer either name survey object descriptive, object \"label\" attribute descriptive. Let’s set attribute mysurvey: mysurvey object now identical namcs2019sv. Let’s verify : just successfully created survey object data frame.","code":"attr(namcs2019sv_df$AGE, \"label\") #> [1] \"Patient age in years\" mysurvey = survey::svydesign(ids = ~ CPSUM , strata = ~ CSTRATM , weights = ~ PATWT , data = namcs2019sv_df) attr(mysurvey, \"label\") = \"NAMCS 2019 PUF\" identical(namcs2019sv, mysurvey) #> [1] TRUE"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"begin-analysis","dir":"Articles","previous_headings":"","what":"Begin analysis","title":"Introduction to surveytable","text":"First, specify survey object ’d like analyze. Survey info {NAMCS 2019 PUF} Check survey label, survey design variables, number observations verify looks correct.","code":"set_survey(namcs2019sv)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"list-variables","dir":"Articles","previous_headings":"Begin analysis","what":"List variables","title":"Introduction to surveytable","text":"var_list() function lists variables survey. avoid unintentionally listing variables survey, can many, starting characters variable names specified. example, list variables start letters age, type: Variables beginning ‘age’ {NAMCS 2019 PUF} table lists variable name; class, type variable; variable label, long name variable. Common classes factor (categorical variable), logical (yes / variable), numeric.","code":"var_list(\"age\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"tabulate-categorical-and-logical-variables","dir":"Articles","previous_headings":"","what":"Tabulate categorical and logical variables","title":"Introduction to surveytable","text":"main function surveytable package tab(), tabulates variables. operates categorical logical variables, presents estimated counts, standard errors (SEs) 95% confidence intervals (CIs), percentages, SEs CIs. example, tabulate AGER, type: Patient age recode {NAMCS 2019 PUF} table title shows variable label (long variable name) survey label. level variable, table shows: estimated count, standard error, 95% confidence interval; estimated percentage, standard error, 95% confidence interval. NCHS presentation standards. tab() function also applies National Center Health Statistics (NCHS) presentation standards counts percentages, flags estimates , according standards, suppressed, footnoted, reviewed analyst. CIs displayed ones used NCHS presentation standards. Specifically, counts, tables show log Student’s t 95% CI, adaptations complex surveys; percentages, show 95% Korn Graubard CI. One need anything extra perform presentation standards checking – performed automatically. example, let’s tabulate PAYNOCHG: Expected source payment visit: Charge/Charity {NAMCS 2019 PUF} table tells us , according NCHS presentation standards, estimated number visits charge visit suppressed due low precision. However, lack percentage flag indicates estimated percentage visits can shown. Drop missing values. variables might contain missing values (NA). Consider following variable, part actual survey, constructed specifically example: Type specialty (BAD - use) {NAMCS 2019 PUF} calculate percentages based non-missing values , use drop_na argument: Type specialty (BAD - use) (knowns ) {NAMCS 2019 PUF} table gives percentages based knowns, , based non-NA values. Multiple tables. Multiple tables can created single command: Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF}","code":"tab(\"AGER\") tab(\"PAYNOCHG\") tab(\"SPECCAT.bad\") tab(\"SPECCAT.bad\", drop_na = TRUE) tab(\"MDDO\", \"SPECCAT\", \"MSA\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"entire-population","dir":"Articles","previous_headings":"Tabulate categorical and logical variables","what":"Entire population","title":"Introduction to surveytable","text":"Estimate total count entire population using total() command: Total {NAMCS 2019 PUF}","code":"total()"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"subsets-or-interactions","dir":"Articles","previous_headings":"Tabulate categorical and logical variables","what":"Subsets or interactions","title":"Introduction to surveytable","text":"create table AGER value variable SEX, type: Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} addition giving long name variable tabulated, title table reflects value subsetting variable (case, either Female Male). tab_subset() command, table (, subset), percentages add 100%. tab_cross() function similar – crosses interacts two variables generates table using new variable. Thus, create table interaction AGER SEX, type: (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} estimated counts produced tab_subset() tab_cross() , percentages different. tab_subset() command, within table (, within subset), percentages add 100%. hand, tab_cross(), percentages across entire population add 100%.","code":"tab_subset(\"AGER\", \"SEX\") tab_cross(\"AGER\", \"SEX\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"tabulate-numeric-variables","dir":"Articles","previous_headings":"","what":"Tabulate numeric variables","title":"Introduction to surveytable","text":"tab() tab_subset() functions also work numeric variables, though variables, output different. tabulate NUMMED (number medications), numeric variable, type: Number medications coded {NAMCS 2019 PUF} , table title shows variable label (long variable name) survey label. table shows percentage values missing (NA), mean, standard error mean (SEM), standard deviation (SD). Subsetting works : Number medications coded (different levels Patient age recode) {NAMCS 2019 PUF}","code":"tab(\"NUMMED\") tab_subset(\"NUMMED\", \"AGER\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"perform-statistical-hypothesis-testing","dir":"Articles","previous_headings":"","what":"Perform statistical hypothesis testing","title":"Introduction to surveytable","text":"tab_subset() function makes easy perform hypothesis testing using test argument. argument TRUE, test association performed. addition, t-tests pairs levels performed well.","code":""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"categorical-variables","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Categorical variables","title":"Introduction to surveytable","text":"Consider relationship AGER SPECCAT: Patient age recode (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Patient age recode (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Patient age recode (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Association Patient age recode Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 15 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 15-24 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 25-44 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 45-64 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 65-74 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 75 years ) {NAMCS 2019 PUF} According tables, association physician specialty type patient age. instance, patients 15 years, statistical difference primary care physician specialty medical care specialty. older patients, 45-64 age group, statistical difference two specialty types. another example, consider relationship MRI SPECCAT: MRI (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} MRI (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} MRI (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Association MRI Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (MRI = FALSE) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (MRI = TRUE) {NAMCS 2019 PUF} According tables, statistical association MRI physician specialty. 3 specialty types, minority visits MRI’s. visits MRI’s, statistical difference specialty types. general rule thumb, since statistical association MRI physician specialty, presenting tabulation particularly interesting, especially since subsetting decreases sample size therefore also decreases estimate reliability. Instead, generally make sense just tabulate MRI without subsetting SPECCAT.","code":"tab_subset(\"AGER\", \"SPECCAT\", test = TRUE) tab_subset(\"MRI\", \"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"numeric-variables","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Numeric variables","title":"Introduction to surveytable","text":"relationship NUMMED AGER: Number medications coded (different levels Patient age recode) {NAMCS 2019 PUF} Association Number medications coded Patient age recode {NAMCS 2019 PUF} Comparison Number medications coded across possible pairs Patient age recode {NAMCS 2019 PUF} According tables, association number medications age category. NUMMED statistically similar “15 years” “15-24 years” AGER categories. statistically different pairs age categories. Finally, let’s look relationship NUMMED SPECCAT: Number medications coded (different levels Type specialty (Primary, Medical, Surgical)) {NAMCS 2019 PUF} Association Number medications coded Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison Number medications coded across possible pairs Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} According tables, association number medications physician specialty type. NUMMED statistically similar pairs physician specialties. general rule thumb, since statistical association number medications physician specialty, presenting tabulation particularly interesting, especially since subsetting decreases sample size therefore also decreases estimate reliability. Instead, generally make sense just tabulate NUMMED without subsetting SPECCAT.","code":"tab_subset(\"NUMMED\", \"AGER\", test = TRUE) tab_subset(\"NUMMED\", \"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"categorical-variables-single-variable","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Categorical variables (single variable)","title":"Introduction to surveytable","text":"test whether pair SPECCAT levels statistically similar different, type: Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} According , surgical medical care specialties statistically similar, statistically different primary care.","code":"tab(\"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"calculate-rates","dir":"Articles","previous_headings":"","what":"Calculate rates","title":"Introduction to surveytable","text":"rate ratio count estimates based survey question divided population size, assumed known. example, number physician visits per 100 people population rate: number physician visits estimated namcs2019sv survey, number people population comes another source. calculate rates, addition survey, need source information population size. typically use function read.csv() load population figures get correct format. surveytable package comes object called uspop2019 contains several population figures use examples. Let’s examine uspop2019: overall population size country whole : overall population size, overall rate : Total (rate per 100 population) {NAMCS 2019 PUF} calculate rates particular variable, need provide data frame column called Level matches levels variable survey, column called Population gives size population level. example, AGER, data frame follows: Now appropriate population figures, rates table obtained typing: Patient age recode (rate per 100 population) {NAMCS 2019 PUF} calculate rates one variable (AGER) another variable (SEX), need population figures following format: data frame, rates table obtained typing: Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF}","code":"class(uspop2019) #> [1] \"list\" names(uspop2019) #> [1] \"total\" \"MSA\" \"AGER\" \"Age group\" \"SEX\" #> [6] \"AGER x SEX\" \"Age group 5\" uspop2019$total #> [1] 323186697 total_rate(uspop2019$total) uspop2019$AGER #> Level Population #> 1 Under 15 years 60526656 #> 2 15-24 years 41718700 #> 3 25-44 years 85599410 #> 4 45-64 years 82562049 #> 5 65-74 years 31260202 #> 6 75 years and over 21519680 tab_rate(\"AGER\", uspop2019$AGER) uspop2019$`AGER x SEX` #> Level Subset Population #> 1 Under 15 years Female 29604762 #> 2 15-24 years Female 20730118 #> 3 25-44 years Female 43192143 #> 4 45-64 years Female 42508901 #> 5 65-74 years Female 16673240 #> 6 75 years and over Female 12421444 #> 7 Under 15 years Male 30921894 #> 8 15-24 years Male 20988582 #> 9 25-44 years Male 42407267 #> 10 45-64 years Male 40053148 #> 11 65-74 years Male 14586962 #> 12 75 years and over Male 9098236 tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"create-or-modify-variables","dir":"Articles","previous_headings":"","what":"Create or modify variables","title":"Introduction to surveytable","text":"situations, might necessary modify survey variables, create new ones. section describes . Convert factor logical. variable MAJOR (major reason visit) several levels. Major reason visit {NAMCS 2019 PUF} Notice one levels called \"Preventive care\". Suppose analyst interested whether visit preventive care visit – interested visit types. can create new variable called Preventive care visits TRUE preventive care visits FALSE types visits, follows: Preventive care visits {NAMCS 2019 PUF} creates logical variable TRUE preventive care visits tabulates . using var_case() function, specify name new logical variable created, existing factor variable, one levels factor variable set TRUE logical variable. Thus, analyst interested surgery-related visits, indicated two different levels MAJOR, type: Surgery-related visits {NAMCS 2019 PUF} Collapse levels. variable PRIMCARE (whether physician patient’s primary care provider) levels Unknown Blank, among others. patient’s primary care provider? {NAMCS 2019 PUF} collapse Unknown Blank single level, type: patient’s primary care provider? {NAMCS 2019 PUF} Convert numeric factor. variable AGE numeric. Patient age years {NAMCS 2019 PUF} create new variable age categories based AGE, type: Age group {NAMCS 2019 PUF} var_cut() command, specify following information: name new categorical variable; name existing numeric variable; cut points – note intervals inclusive right; category labels. Check whether variable true. series logical variables, can check whether TRUE using var_any() command. physician visit considered “imaging services” visit number imaging services ordered provided. Imaging services indicated using logical variables, MRI XRAY. create Imaging services variable, type: Imaging services {NAMCS 2019 PUF} Interact variables. tab_cross() function creates table interaction two variables, save interacted variable. create interacted variable, use var_cross() command: Specify name new variable well names two variables interact. Copy variable. Create new variable copy another variable using var_copy(). can modify copy, original remains unchanged. example: Patient age recode {NAMCS 2019 PUF} Age group {NAMCS 2019 PUF} , AGER variable remains unchanged, Age group variable fewer categories. variables data frame. Recall survey objects element called variables, data frame contains survey variables. advanced users can create modify variables variables data frame directly. modify variables, must call set_survey() . example: Survey info {NAMCS 2019 PUF} Medicare Medicaid {NAMCS 2019 PUF} Note, however, var_*() functions modify survey object specified set_survey() directly. Rather, modify variables inside following data frame: surveytable:::env$survey$variables. use var_*() functions need access modified / created variables, ’s look. example:","code":"tab(\"MAJOR\") var_case(\"Preventive care visits\", \"MAJOR\", \"Preventive care\") tab(\"Preventive care visits\") var_case(\"Surgery-related visits\" , \"MAJOR\" , c(\"Pre-surgery\", \"Post-surgery\")) tab(\"Surgery-related visits\") tab(\"PRIMCARE\") var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Unknown\", \"Blank\")) tab(\"PRIMCARE\") tab(\"AGE\") var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) tab(\"Age group\") var_any(\"Imaging services\" , c(\"ANYIMAGE\", \"BONEDENS\", \"CATSCAN\", \"ECHOCARD\", \"OTHULTRA\" , \"MAMMO\", \"MRI\", \"XRAY\", \"OTHIMAGE\")) tab(\"Imaging services\") var_cross(\"Age x Sex\", \"AGER\", \"SEX\") var_copy(\"Age group\", \"AGER\") #> Warning in var_copy(\"Age group\", \"AGER\"): Age group: overwriting a variable #> that already exists. var_collapse(\"Age group\", \"65+\", c(\"65-74 years\", \"75 years and over\")) var_collapse(\"Age group\", \"25-64\", c(\"25-44 years\", \"45-64 years\")) tab(\"AGER\", \"Age group\") class(namcs2019sv$variables) #> [1] \"data.frame\" namcs2019sv$variables$`Medicare and Medicaid` = ( namcs2019sv$variables$PAYMCARE & namcs2019sv$variables$PAYMCAID) set_survey(namcs2019sv) tab(\"Medicare and Medicaid\") var_cross(\"newvar\", \"MAJOR\", \"AGER\") # This should give NULL. The new variable does not exist here: namcs2019sv$variables$newvar #> NULL # Rather, the new variable is here: str(surveytable:::env$survey$variables$newvar) #> Factor w/ 42 levels \"Blank : Under 15 years\",..: 17 31 24 38 38 24 30 31 24 38 ... #> - attr(*, \"label\")= chr \"(Major reason for this visit) x (Patient age recode)\""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"save-the-output","dir":"Articles","previous_headings":"","what":"Save the output","title":"Introduction to surveytable","text":"tab* total* functions argument called csv specifies name comma-separated values (CSV) file save output . Alternatively, can name default CSV output file using set_output() function. example, following directs surveytable send future output CSV file, create tables, turn sending output file: Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF} tabulation functions called within R Markdown notebook, produce HTML tables. makes easy incorporate output surveytable package directly documents, presentations, “shiny” web apps, output types. Finally, tabulation functions return tables produce. advanced analysts can use functionality integrate surveytable programming tasks.","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) tab(\"MDDO\", \"SPECCAT\", \"MSA\") set_output(csv = \"\") #> * Turning off CSV output. #> * ?set_output for other options."},{"path":"https://cdcgov.github.io/surveytable/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Alex Strashny. Author, maintainer.","code":""},{"path":"https://cdcgov.github.io/surveytable/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Strashny (2023). surveytable: Formatted Survey Estimates. https://cdcgov.github.io/surveytable/, https://github.com/CDCgov/surveytable.","code":"@Manual{, title = {surveytable: Formatted Survey Estimates}, author = {Alex Strashny}, year = {2023}, note = {https://cdcgov.github.io/surveytable/, https://github.com/CDCgov/surveytable}, }"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"survey-table-formatted-survey-estimates","dir":"","previous_headings":"","what":"Formatted Survey Estimates","title":"Formatted Survey Estimates","text":"surveytable package provides short understandable commands generate tabulated, formatted, rounded survey estimates. One useful function, operates categorical logical variables, tabulates estimated counts percentages standard errors confidence intervals. functions list variables survey, estimate total population, tabulate survey subsets variable interactions, tabulate numeric variables, tabulate rates, create modify survey variables, perform hypothesis tests, save output. tabulation functions check National Center Health Statistics (NCHS) presentation standards flag low-precision estimates. surveytable code called R Markdown notebook Quarto document, generates HTML tables, can incorporated directly documents.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Formatted Survey Estimates","text":"Install CRAN: get development version GitHub:","code":"install.packages(\"surveytable\") install.packages(c(\"remotes\", \"git2r\")) remotes::install_github(\"CDCgov/surveytable\", upgrade = \"never\")"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"Formatted Survey Estimates","text":"Find documentation surveytable : https://cdcgov.github.io/surveytable/","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Formatted Survey Estimates","text":"basic example, get started. Survey info {NAMCS 2019 PUF} Patient age recode {NAMCS 2019 PUF}","code":"library(surveytable) set_survey(namcs2019sv) tab(\"AGER\")"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"public-domain-standard-notice","dir":"","previous_headings":"","what":"Public Domain Standard Notice","title":"Formatted Survey Estimates","text":"repository constitutes work United States Government subject domestic copyright protection 17 USC § 105. repository public domain within United States, copyright related rights work worldwide waived CC0 1.0 Universal public domain dedication. contributions repository released CC0 dedication. submitting pull request agreeing comply waiver copyright interest.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"license-standard-notice","dir":"","previous_headings":"","what":"License Standard Notice","title":"Formatted Survey Estimates","text":"repository utilizes code licensed terms Apache Software License therefore licensed ASL v2 later. source code repository free: can redistribute /modify terms Apache Software License version 2, (option) later version. source code repository distributed hope useful, WITHOUT WARRANTY; without even implied warranty MERCHANTABILITY FITNESS PARTICULAR PURPOSE. See Apache Software License details. received copy Apache Software License along program. , see https://www.apache.org/licenses/LICENSE-2.0.html source code forked open source projects inherit license.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"privacy-standard-notice","dir":"","previous_headings":"","what":"Privacy Standard Notice","title":"Formatted Survey Estimates","text":"repository contains non-sensitive, publicly available data information. material community participation covered Disclaimer Code Conduct. information CDC’s privacy policy, please visit https://www.cdc.gov//privacy.html.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"contributing-standard-notice","dir":"","previous_headings":"","what":"Contributing Standard Notice","title":"Formatted Survey Estimates","text":"Anyone encouraged contribute repository forking submitting pull request. (new GitHub, might start basic tutorial.) contributing project, grant world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license users terms Apache Software License v2 later. comments, messages, pull requests, submissions received CDC including GitHub page may subject applicable federal law, including limited Federal Records Act, may archived. Learn https://www.cdc.gov//privacy.html.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"records-management-standard-notice","dir":"","previous_headings":"","what":"Records Management Standard Notice","title":"Formatted Survey Estimates","text":"repository source government records, copy increase collaboration collaborative potential. government records published CDC web site.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"additional-standard-notices","dir":"","previous_headings":"","what":"Additional Standard Notices","title":"Formatted Survey Estimates","text":"Please refer CDC’s Template Repository information contributing repository, public domain notices disclaimers, code conduct.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"Apache License","title":"Apache License","text":"Version 2.0, January 2004 ","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_1-definitions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"1. Definitions","title":"Apache License","text":"“License” shall mean terms conditions use, reproduction, distribution defined Sections 1 9 document. “Licensor” shall mean copyright owner entity authorized copyright owner granting License. “Legal Entity” shall mean union acting entity entities control, controlled , common control entity. purposes definition, “control” means () power, direct indirect, cause direction management entity, whether contract otherwise, (ii) ownership fifty percent (50%) outstanding shares, (iii) beneficial ownership entity. “” (“”) shall mean individual Legal Entity exercising permissions granted License. “Source” form shall mean preferred form making modifications, including limited software source code, documentation source, configuration files. “Object” form shall mean form resulting mechanical transformation translation Source form, including limited compiled object code, generated documentation, conversions media types. “Work” shall mean work authorship, whether Source Object form, made available License, indicated copyright notice included attached work (example provided Appendix ). “Derivative Works” shall mean work, whether Source Object form, based (derived ) Work editorial revisions, annotations, elaborations, modifications represent, whole, original work authorship. purposes License, Derivative Works shall include works remain separable , merely link (bind name) interfaces , Work Derivative Works thereof. “Contribution” shall mean work authorship, including original version Work modifications additions Work Derivative Works thereof, intentionally submitted Licensor inclusion Work copyright owner individual Legal Entity authorized submit behalf copyright owner. purposes definition, “submitted” means form electronic, verbal, written communication sent Licensor representatives, including limited communication electronic mailing lists, source code control systems, issue tracking systems managed , behalf , Licensor purpose discussing improving Work, excluding communication conspicuously marked otherwise designated writing copyright owner “Contribution.” “Contributor” shall mean Licensor individual Legal Entity behalf Contribution received Licensor subsequently incorporated within Work.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_2-grant-of-copyright-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"2. Grant of Copyright License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable copyright license reproduce, prepare Derivative Works , publicly display, publicly perform, sublicense, distribute Work Derivative Works Source Object form.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_3-grant-of-patent-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"3. Grant of Patent License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable (except stated section) patent license make, made, use, offer sell, sell, import, otherwise transfer Work, license applies patent claims licensable Contributor necessarily infringed Contribution(s) alone combination Contribution(s) Work Contribution(s) submitted. institute patent litigation entity (including cross-claim counterclaim lawsuit) alleging Work Contribution incorporated within Work constitutes direct contributory patent infringement, patent licenses granted License Work shall terminate date litigation filed.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_4-redistribution","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"4. Redistribution","title":"Apache License","text":"may reproduce distribute copies Work Derivative Works thereof medium, without modifications, Source Object form, provided meet following conditions: () must give recipients Work Derivative Works copy License; (b) must cause modified files carry prominent notices stating changed files; (c) must retain, Source form Derivative Works distribute, copyright, patent, trademark, attribution notices Source form Work, excluding notices pertain part Derivative Works; (d) Work includes “NOTICE” text file part distribution, Derivative Works distribute must include readable copy attribution notices contained within NOTICE file, excluding notices pertain part Derivative Works, least one following places: within NOTICE text file distributed part Derivative Works; within Source form documentation, provided along Derivative Works; , within display generated Derivative Works, wherever third-party notices normally appear. contents NOTICE file informational purposes modify License. may add attribution notices within Derivative Works distribute, alongside addendum NOTICE text Work, provided additional attribution notices construed modifying License. may add copyright statement modifications may provide additional different license terms conditions use, reproduction, distribution modifications, Derivative Works whole, provided use, reproduction, distribution Work otherwise complies conditions stated License.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_5-submission-of-contributions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"5. Submission of Contributions","title":"Apache License","text":"Unless explicitly state otherwise, Contribution intentionally submitted inclusion Work Licensor shall terms conditions License, without additional terms conditions. Notwithstanding , nothing herein shall supersede modify terms separate license agreement may executed Licensor regarding Contributions.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_6-trademarks","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"6. Trademarks","title":"Apache License","text":"License grant permission use trade names, trademarks, service marks, product names Licensor, except required reasonable customary use describing origin Work reproducing content NOTICE file.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_7-disclaimer-of-warranty","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"7. Disclaimer of Warranty","title":"Apache License","text":"Unless required applicable law agreed writing, Licensor provides Work (Contributor provides Contributions) “” BASIS, WITHOUT WARRANTIES CONDITIONS KIND, either express implied, including, without limitation, warranties conditions TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS PARTICULAR PURPOSE. solely responsible determining appropriateness using redistributing Work assume risks associated exercise permissions License.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_8-limitation-of-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"8. Limitation of Liability","title":"Apache License","text":"event legal theory, whether tort (including negligence), contract, otherwise, unless required applicable law (deliberate grossly negligent acts) agreed writing, shall Contributor liable damages, including direct, indirect, special, incidental, consequential damages character arising result License use inability use Work (including limited damages loss goodwill, work stoppage, computer failure malfunction, commercial damages losses), even Contributor advised possibility damages.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_9-accepting-warranty-or-additional-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"9. Accepting Warranty or Additional Liability","title":"Apache License","text":"redistributing Work Derivative Works thereof, may choose offer, charge fee , acceptance support, warranty, indemnity, liability obligations /rights consistent License. However, accepting obligations, may act behalf sole responsibility, behalf Contributor, agree indemnify, defend, hold Contributor harmless liability incurred , claims asserted , Contributor reason accepting warranty additional liability. END TERMS CONDITIONS","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"appendix-how-to-apply-the-apache-license-to-your-work","dir":"","previous_headings":"","what":"APPENDIX: How to apply the Apache License to your work","title":"Apache License","text":"apply Apache License work, attach following boilerplate notice, fields enclosed brackets [] replaced identifying information. (Don’t include brackets!) text enclosed appropriate comment syntax file format. also recommend file class name description purpose included “printed page” copyright notice easier identification within third-party archives.","code":"Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a codebook for the survey — codebook","title":"Create a codebook for the survey — codebook","text":"Create codebook survey","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a codebook for the survey — codebook","text":"","code":"codebook(all = FALSE, csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a codebook for the survey — codebook","text":"tabulate variables? csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a codebook for the survey — codebook","text":"list tables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a codebook for the survey — codebook","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> codebook() #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> #> Codebook {NAMCS 2019 PUF} #> ┌──────────┬─────────────┬───────────────────────┬─────────┬─────────────┬───────────────────────┐ #> │ Item no. │ Variable │ Description │ Class │ Missing (%) │ Values │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 1 │ CPSUM │ Masked provider │ numeric │ 0 │ 100001 - 100398 │ #> │ │ │ marker │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 2 │ CSTRATM │ Masked sampling │ numeric │ 0 │ 10119101 - 10419115 │ #> │ │ │ stratum from which │ │ │ │ #> │ │ │ provider was selected │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 3 │ PATWT │ Patient visit weight │ numeric │ 0 │ 7064.00718 - │ #> │ │ │ used for national and │ │ │ 1120996.55599 │ #> │ │ │ subnational estimates │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 4 │ MDDO │ Type of doctor (MD or │ factor │ 0 │ M.D. - Doctor of │ #> │ │ │ DO) │ │ │ Medicine, D.O. - │ #> │ │ │ │ │ │ Doctor of Osteopathy │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 5 │ SPECCAT │ Type of specialty │ factor │ 0 │ Primary care │ #> │ │ │ (Primary, Medical, │ │ │ specialty, Surgical │ #> │ │ │ Surgical) │ │ │ care specialty, │ #> │ │ │ │ │ │ Medical care │ #> │ │ │ │ │ │ specialty │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 6 │ MSA │ Metropolitan │ factor │ 0 │ MSA (Metropolitan │ #> │ │ │ Statistical Area │ │ │ Statistical Area), │ #> │ │ │ Status of physician │ │ │ Non-MSA │ #> │ │ │ location │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 7 │ AGER │ Patient age recode │ factor │ 0 │ Under 15 years, 15-24 │ #> │ │ │ │ │ │ years, 25-44 years, │ #> │ │ │ │ │ │ 45-64 years, 65-74 │ #> │ │ │ │ │ │ years, 75 years and │ #> │ │ │ │ │ │ over │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 8 │ SEX │ Patient sex │ factor │ 0 │ Female, Male │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 9 │ AGE │ Patient age in years │ numeric │ 0 │ 0 - 94 │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 10 │ NOPAY │ Expected source of │ factor │ 0 │ One or more │ #> │ │ │ payment for visit: No │ │ │ categories marked, No │ #> │ │ │ answer to item │ │ │ categories marked │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 11 │ PAYPRIV │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Private insurance │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 12 │ PAYMCARE │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Medicare │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 13 │ PAYMCAID │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Medicaid or CHIP or │ │ │ │ #> │ │ │ other state-based │ │ │ │ #> │ │ │ program │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 14 │ PAYWKCMP │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Workers Compensation │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 15 │ PAYOTH │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Other │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 16 │ PAYDK │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Unknown │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 17 │ PAYSELF │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Self-pay │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 18 │ PAYNOCHG │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: No │ │ │ │ #> │ │ │ Charge/Charity │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 19 │ PRIMCARE │ Are you the patient's │ factor │ 0 │ Blank, Unknown, Yes, │ #> │ │ │ primary care │ │ │ No │ #> │ │ │ provider? │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 20 │ REFER │ Was patient referred │ factor │ 0 │ Blank, Unknown, Not │ #> │ │ │ for visit? │ │ │ applicable, Yes, No │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 21 │ SENBEFOR │ Has this patient been │ factor │ 0 │ Yes, established │ #> │ │ │ seen in your practice │ │ │ patient, No, new │ #> │ │ │ before? │ │ │ patient │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 22 │ MAJOR │ Major reason for this │ factor │ 0 │ Blank, New problem │ #> │ │ │ visit │ │ │ (less than 3 mos. │ #> │ │ │ │ │ │ onset), Chronic │ #> │ │ │ │ │ │ problem, routine, │ #> │ │ │ │ │ │ Chronic problem, │ #> │ │ │ │ │ │ flare-up, │ #> │ │ │ │ │ │ Pre-surgery, │ #> │ │ │ │ │ │ Post-surgery, │ #> │ │ │ │ │ │ Preventive care │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 23 │ NUMMED │ Number of medications │ numeric │ 0 │ 0 - 30 │ #> │ │ │ coded │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 24 │ ANYIMAGE │ Any imaging │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 25 │ BONEDENS │ Bone mineral density │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 26 │ CATSCAN │ CT Scan │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 27 │ ECHOCARD │ Echocardiogram │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 28 │ OTHULTRA │ Ultrasound │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 29 │ MAMMO │ Mammography │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 30 │ MRI │ MRI │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 31 │ XRAY │ X-ray │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 32 │ OTHIMAGE │ Other imaging │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 33 │ SPECCAT.bad │ Type of specialty │ factor │ 20 │ Primary care │ #> │ │ │ (BAD - do not use) │ │ │ specialty, Surgical │ #> │ │ │ │ │ │ care specialty, │ #> │ │ │ │ │ │ Medical care │ #> │ │ │ │ │ │ specialty │ #> └──────────┴─────────────┴───────────────────────┴─────────┴─────────────┴───────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":null,"dir":"Reference","previous_headings":"","what":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"Selected variables data system visits office-based physicians. Note unit observation visits, patients - distinction important since single patient can make multiple visits.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"","code":"namcs2019sv namcs2019sv_df"},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"object class survey.design2 (inherits survey.design) 8250 rows 33 columns. object class data.frame 8250 rows 33 columns.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"SAS data: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/namcs2019_sas.zip Survey design variables: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/readme2019-sas.txt SAS formats: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/nam19for.txt Documentation: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/doc2019-508.pdf National Summary Tables: https://www.cdc.gov/nchs/data/ahcd/namcs_summary/2019-namcs-web-tables-508.pdf","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"namcs2019sv_df data frame. namcs2019sv survey object created namcs2019sv_df using [survey::svydesign()].","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Print surveytable tables — print.surveytable_table","title":"Print surveytable tables — print.surveytable_table","text":"Print surveytable tables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print surveytable tables — print.surveytable_table","text":"","code":"# S3 method for surveytable_table print(x, ...) # S3 method for surveytable_list print(x, ...)"},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print surveytable tables — print.surveytable_table","text":"x object class surveytable_table surveytable_list. ... ignored","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print surveytable tables — print.surveytable_table","text":"x invisibly.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print surveytable tables — print.surveytable_table","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> table1 = tab(\"AGER\") print(table1) #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> table_many = tab(\"MDDO\", \"SPECCAT\", \"MSA\") print(table_many) #> Type of doctor (MD or DO) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ M.D. - Doctor │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ #> │ of Medicine │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ D.O. - Doctor │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ #> │ of Osteopathy │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Primary care │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Surgical care │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Medical care │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Metropolitan Statistical Area Status of physician location {NAMCS 2019 #> PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ MSA │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ #> │ (Metropolitan │ │ │ │ │ │ │ │ │ #> │ Statistical │ │ │ │ │ │ │ │ │ #> │ Area) │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ Non-MSA │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ #> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding counts — set_count_1k","title":"Rounding counts — set_count_1k","text":"Determines counts rounded.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding counts — set_count_1k","text":"","code":"set_count_1k() set_count_int()"},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Rounding counts — set_count_1k","text":"(Nothing.)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Rounding counts — set_count_1k","text":"set_count_1k(): round counts nearest 1,000. set_count_int(): round counts nearest integer.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Rounding counts — set_count_1k","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> set_count_int() #> * Rounding counts to the nearest integer. #> * ?set_count_int for other options. total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬────────────┬─────────────┬───────────────┐ #> │ Number │ SE │ LL │ UL │ #> ├───────────────┼────────────┼─────────────┼───────────────┤ #> │ 1,036,484,356 │ 48,836,217 │ 945,013,590 │ 1,136,808,860 │ #> └───────────────┴────────────┴─────────────┴───────────────┘ #> (Checked presentation standards. Nothing to #> report.) #> set_count_1k() #> * Rounding counts to the nearest 1,000. #> * ?set_count_1k for other options. total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┐ #> │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ #> ├───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ #> └───────────────┴───────────────┴───────────────┴───────────────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Set output defaults — set_output","title":"Set output defaults — set_output","text":"show_output() shows current defaults.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set output defaults — set_output","text":"","code":"set_output(drop_na = NULL, max_levels = NULL, csv = NULL) show_output()"},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set output defaults — set_output","text":"drop_na drop missing values (NA)? Categorical variables . max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file \"\" turn CSV output","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set output defaults — set_output","text":"(Nothing.)","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set output defaults — set_output","text":"","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> set_output(csv = \"\") # Turn off CSV output #> * Turning off CSV output. #> * ?set_output for other options."},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Specify the survey to analyze — set_survey","title":"Specify the survey to analyze — set_survey","text":"need specify survey functions, tab(), work.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Specify the survey to analyze — set_survey","text":"","code":"set_survey(design, opts = \"NCHS\", csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Specify the survey to analyze — set_survey","text":"design either survey object (survey.design svyrep.design) data.frame unweighted survey. opts set certain options. See . csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Specify the survey to analyze — set_survey","text":"Info survey.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Specify the survey to analyze — set_survey","text":"opts: \"nchs\": Round counts nearest 1,000 -- see set_count_1k(). Identify low-precision estimates (surveytable.check_present option). Percentage CI's: adjust Korn-Graubard CI's number degrees freedom, matching SUDAAN calculation (surveytable.adjust_svyciprop option). \"general\": Round counts nearest integer -- see set_count_int(). look low-precision estimates (surveytable.check_present option). Percentage CI's: use standard Korn-Graubard CI's. Optionally, survey can attribute called label, long name survey. Optionally, variable survey can attribute called label, variable's long name.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Specify the survey to analyze — set_survey","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Show package options — show_options","title":"Show package options — show_options","text":"Show package options","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show package options — show_options","text":"","code":"show_options(sw = \"surveytable\")"},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show package options — show_options","text":"sw starting characters","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show package options — show_options","text":"List options values.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show package options — show_options","text":"","code":"show_options() #> $surveytable.adjust_svyciprop #> [1] TRUE #> #> $surveytable.adjust_svyciprop.df_method #> [1] \"NHIS\" #> #> $surveytable.check_present #> [1] TRUE #> #> $surveytable.csv #> [1] \"\" #> #> $surveytable.drop_na #> [1] FALSE #> #> $surveytable.max_levels #> [1] 20 #> #> $surveytable.names_count #> [1] \"Number (000)\" \"SE (000)\" \"LL (000)\" \"UL (000)\" #> #> $surveytable.names_prct #> [1] \"Percent\" \"SE\" \"LL\" \"UL\" #> #> $surveytable.present_count #> [1] \".present_count\" #> #> $surveytable.present_prop #> [1] \".present_prop\" #> #> $surveytable.present_restricted #> [1] \".present_restricted\" #> #> $surveytable.rate_per #> [1] 100 #> #> $surveytable.survey_label #> [1] \"NAMCS 2019 PUF\" #> #> $surveytable.svychisq_statistic #> [1] \"F\" #> #> $surveytable.tx_count #> [1] \".tx_count_1k\" #> #> $surveytable.tx_prct #> [1] \".tx_prct\" #> #> $surveytable.tx_rate #> [1] \".tx_rate\" #>"},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-options.html","id":null,"dir":"Reference","previous_headings":"","what":"Package options — surveytable-options","title":"Package options — surveytable-options","text":"Run show_options() see available options.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-options.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Package options — surveytable-options","text":"Maintainer: Alex Strashny AStrashny@cdc.gov (ORCID)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-package.html","id":null,"dir":"Reference","previous_headings":"","what":"surveytable: Formatted Survey Estimates — surveytable-package","title":"surveytable: Formatted Survey Estimates — surveytable-package","text":"Short understandable commands generate tabulated, formatted, rounded survey estimates. Mostly wrapper 'survey' package (Lumley (2004) doi:10.18637/jss.v009.i08 https://CRAN.R-project.org/package=survey) identifies low-precision estimates using National Center Health Statistics (NCHS) presentation standards (Parker et al. (2017) https://www.cdc.gov/nchs/data/series/sr_02/sr02_175.pdf, Parker et al. (2023) doi:10.15620/cdc:124368 ).","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"surveytable: Formatted Survey Estimates — surveytable-package","text":"Maintainer: Alex Strashny AStrashny@cdc.gov (ORCID)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset a survey, while preserving variable labels — survey_subset","title":"Subset a survey, while preserving variable labels — survey_subset","text":"Subset survey, preserving variable labels","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset a survey, while preserving variable labels — survey_subset","text":"","code":"survey_subset(design, subset, label)"},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset a survey, while preserving variable labels — survey_subset","text":"design survey object subset expression specifying sub-population label survey label newly created survey object","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset a survey, while preserving variable labels — survey_subset","text":"new survey object","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subset a survey, while preserving variable labels — survey_subset","text":"","code":"children = survey_subset(namcs2019sv, AGE < 18, \"Children < 18\") set_survey(children) #> Survey info {Children < 18} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 1,066 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (139) clusters. │ #> │ │ │ survey_subset(namcs2019sv, AGE < 18, \"Children │ #> │ │ │ < 18\") │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {Children < 18} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 86.1 │ 1.6 │ 82.6 │ 89.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 19,004 │ 2,872 │ 14,051 │ 25,702 │ 13.9 │ 1.6 │ 10.8 │ 17.4 │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":null,"dir":"Reference","previous_headings":"","what":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"version survey::svyciprop() adjusts degrees freedom method = \"beta\".","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"","code":"svyciprop_adjusted( formula, design, method = c(\"logit\", \"likelihood\", \"asin\", \"beta\", \"mean\", \"xlogit\"), level = 0.95, df_method, ... )"},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"formula see survey::svyciprop(). design see survey::svyciprop(). method see survey::svyciprop(). level see survey::svyciprop(). df_method df calculated: \"default\" \"NHIS\". ... see survey::svyciprop().","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"point estimate proportion, confidence interval attribute.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"Written Makram Talih 2019. df_method: \"default\", df = degf(design); \"NHIS\", df = nrow(design) - 1. use function tabulations, call set_survey() opts = \"NCHS\" argument, type: options(surveytable.adjust_svyciprop = TRUE).","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"","code":"set_survey(namcs2019sv, opts = \"NCHS\") #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate variables — tab","title":"Tabulate variables — tab","text":"Tabulate categorical (factor), logical, numeric variables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate variables — tab","text":"","code":"tab( ..., test = FALSE, alpha = 0.05, drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate variables — tab","text":"... names variables (quotes) test perform hypothesis tests? alpha significance level tests drop_na drop missing values (NA)? Categorical variables . max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate variables — tab","text":"list tables single table.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tabulate variables — tab","text":"categorical logical variables, presents estimated counts, standard errors (SEs) confidence intervals (CIs), percentages, SEs CIs. Checks presentation guidelines counts percentages flags estimates , according guidelines, suppressed, footnoted, reviewed analyst. numeric variables, presents percentage observations known values, mean known values, standard error mean (SEM), standard deviation (SD). CIs calculated 95% confidence level. CIs count estimates log Student's t CIs, adaptations complex surveys. CIs percentage estimates Korn Graubard CIs.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate variables — tab","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> tab(\"MDDO\", \"SPECCAT\", \"MSA\") #> Type of doctor (MD or DO) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ M.D. - Doctor │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ #> │ of Medicine │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ D.O. - Doctor │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ #> │ of Osteopathy │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Primary care │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Surgical care │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Medical care │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ #> │ specialty │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Metropolitan Statistical Area Status of physician location {NAMCS 2019 #> PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ MSA │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ #> │ (Metropolitan │ │ │ │ │ │ │ │ │ #> │ Statistical │ │ │ │ │ │ │ │ │ #> │ Area) │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ Non-MSA │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ #> └───────────────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> # Numeric variables tab(\"NUMMED\") #> Number of medications coded {NAMCS 2019 PUF} #> ┌─────────┬──────┬───────┬──────┐ #> │ % known │ Mean │ SEM │ SD │ #> ├─────────┼──────┼───────┼──────┤ #> │ 100 │ 3.46 │ 0.268 │ 4.43 │ #> └─────────┴──────┴───────┴──────┘ #> # Hypothesis testing with categorical variables tab(\"AGER\", test = TRUE) #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Comparison of all possible pairs of Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ #> │ Level 1 │ Level 2 │ p-value │ Flag │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 15-24 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 25-44 years │ 0.012 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 75 years and over │ 0.022 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 25-44 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 65-74 years │ 0.065 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 75 years and over │ 0.878 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 65-74 years │ 75 years and over │ 0.019 │ * │ #> └────────────────┴───────────────────┴─────────┴──────┘ #> Design-based t-test. *: p-value <= 0.05 #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate rates — tab_rate","title":"Calculate rates — tab_rate","text":"Calculate rates categorical (factor) logical variables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate rates — tab_rate","text":"","code":"tab_rate( vr, pop, per = getOption(\"surveytable.rate_per\"), drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate rates — tab_rate","text":"vr variable tabulate pop either single number data.frame columns named Level Population. Level must exactly match levels vr. Population population level vr. per calculate rate per many items population drop_na drop missing values (NA)? max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate rates — tab_rate","text":"list tables single table.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate rates — tab_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> # pop is a data frame tab_rate(\"MSA\", uspop2019$MSA) #> Metropolitan Statistical Area Status of physician location (rate per #> 100 population) {NAMCS 2019 PUF} #> ┌────────────────────────────┬───────┬──────┬───────┬───────┐ #> │ Level │ Rate │ SE │ LL │ UL │ #> ├────────────────────────────┼───────┼──────┼───────┼───────┤ #> │ MSA (Metropolitan │ 351.2 │ 18.2 │ 317.2 │ 388.8 │ #> │ Statistical Area) │ │ │ │ │ #> ├────────────────────────────┼───────┼──────┼───────┼───────┤ #> │ Non-MSA │ 136.7 │ 38.2 │ 78.9 │ 236.8 │ #> └────────────────────────────┴───────┴──────┴───────┴───────┘ #> (Checked presentation standards. Nothing to #> report.) #> # pop is a single number tab_rate(\"MDDO\", uspop2019$total) #> * Rate based on the entire population. #> Type of doctor (MD or DO) (rate per 100 population) {NAMCS 2019 PUF} #> ┌────────────────────────────┬───────┬────┬───────┬───────┐ #> │ Level │ Rate │ SE │ LL │ UL │ #> ├────────────────────────────┼───────┼────┼───────┼───────┤ #> │ M.D. - Doctor of Medicine │ 303.3 │ 15 │ 275.3 │ 334.1 │ #> ├────────────────────────────┼───────┼────┼───────┼───────┤ #> │ D.O. - Doctor of │ 17.4 │ 2 │ 13.8 │ 21.9 │ #> │ Osteopathy │ │ │ │ │ #> └────────────────────────────┴───────┴────┴───────┴───────┘ #> (Checked presentation standards. Nothing to #> report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate subsets or interactions — tab_cross","title":"Tabulate subsets or interactions — tab_cross","text":"Create subsets survey using one variable, tabulate another variable within subsets. Interact two variables tabulate.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate subsets or interactions — tab_cross","text":"","code":"tab_cross( vr, vrby, max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") ) tab_subset( vr, vrby, lvls = c(), test = FALSE, alpha = 0.05, drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate subsets or interactions — tab_cross","text":"vr variable tabulate vrby use variable subset survey max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file lvls (optional) show levels vrby test perform hypothesis tests? alpha significance level tests drop_na drop missing values (NA)? Categorical variables .","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate subsets or interactions — tab_cross","text":"list tables single table.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tabulate subsets or interactions — tab_cross","text":"tab_subset creates subsets using levels vrby, tabulates vr subset. Optionally, use lvls levels vrby. vr can categorical (factor), logical, numeric. tab_cross crosses interacts vr vrby tabulates new variable. Tables created using tab_subset tab_cross counts different percentages. tab_subset, percentages within subset add 100%. tab_cross, percentages across entire population add 100%. Also see var_cross(). test = TRUE performs test association two variables. Also performs t-tests possible pairs levels vr vrby.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate subsets or interactions — tab_cross","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> # For each SEX, tabulate AGER tab_subset(\"AGER\", \"SEX\") #> Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 9.9 │ 1.2 │ 7.6 │ 12.6 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 6.8 │ 0.7 │ 5.4 │ 8.4 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 18.8 │ 1.6 │ 15.8 │ 22.1 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 29.1 │ 1.7 │ 25.8 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 19.8 │ 1.5 │ 17   │ 22.9 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 15.6 │ 1.5 │ 12.8 │ 18.7 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 13.4 │ 1.7 │ 10.3 │ 17.1 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 5.5 │ 0.8 │ 4   │ 7.3 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 13.1 │ 1.3 │ 10.7 │ 15.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 30.9 │ 1.6 │ 27.8 │ 34.3 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 20.1 │ 1.5 │ 17.3 │ 23.1 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 16.9 │ 1.5 │ 14   │ 20.2 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> # Same counts as tab_subset(), but different percentages. tab_cross(\"AGER\", \"SEX\") #> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ #> │ years : │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years : │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years : │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years : │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years : │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ #> │ over : Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ #> │ years : Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years : │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years : │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years : │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years : │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ #> │ over : Male │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> # Numeric variables tab_subset(\"NUMMED\", \"AGER\") #> Number of medications coded (for different levels of Patient age #> recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ Under 15 years │ 100 │ 1.58 │ 0.168 │ 1.75 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 15-24 years │ 100 │ 1.64 │ 0.112 │ 1.7  │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 25-44 years │ 100 │ 2.15 │ 0.225 │ 2.74 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 45-64 years │ 100 │ 3.49 │ 0.303 │ 4.49 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 65-74 years │ 100 │ 4.44 │ 0.431 │ 5.03 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 75 years and over │ 100 │ 5.53 │ 0.494 │ 5.59 │ #> └───────────────────┴─────────┴──────┴───────┴──────┘ #> # Hypothesis testing tab_subset(\"NUMMED\", \"AGER\", test = TRUE) #> Number of medications coded (for different levels of Patient age #> recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ Under 15 years │ 100 │ 1.58 │ 0.168 │ 1.75 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 15-24 years │ 100 │ 1.64 │ 0.112 │ 1.7  │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 25-44 years │ 100 │ 2.15 │ 0.225 │ 2.74 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 45-64 years │ 100 │ 3.49 │ 0.303 │ 4.49 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 65-74 years │ 100 │ 4.44 │ 0.431 │ 5.03 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 75 years and over │ 100 │ 5.53 │ 0.494 │ 5.59 │ #> └───────────────────┴─────────┴──────┴───────┴──────┘ #> #> Association between Number of medications coded and Patient age recode #> {NAMCS 2019 PUF} #> ┌─────────────────┬─────────────────┐ #> │ p-value │ Flag │ #> ├─────────────────┼─────────────────┤ #> │ 0 │ * │ #> └─────────────────┴─────────────────┘ #> Wald test. *: p-value <= 0.05 #> #> Comparison of Number of medications coded across all possible pairs of #> Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ #> │ Level 1 │ Level 2 │ p-value │ Flag │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 15-24 years │ 0.739 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 25-44 years │ 0.043 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 25-44 years │ 0.029 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 65-74 years │ 0.007 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 65-74 years │ 75 years and over │ 0.002 │ * │ #> └────────────────┴───────────────────┴─────────┴──────┘ #> Design-based t-test. *: p-value <= 0.05 #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate rates for subsets — tab_subset_rate","title":"Calculate rates for subsets — tab_subset_rate","text":"Create subsets survey using one variable, tabulate rates another variable within subsets.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate rates for subsets — tab_subset_rate","text":"","code":"tab_subset_rate( vr, vrby, pop, lvls = c(), per = getOption(\"surveytable.rate_per\"), drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate rates for subsets — tab_subset_rate","text":"vr variable tabulate vrby use variable subset survey pop data.frame columns named Level, Subset, Population. Level must exactly match levels vr. Subset must exactly match levels vrby. Population population level vr vrby. lvls (optional) show levels vrby per calculate rate per many items population drop_na drop missing values (NA)? max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate rates for subsets — tab_subset_rate","text":"list tables single table.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate rates for subsets — tab_subset_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`) #> Patient age recode (Patient sex = Female) (rate per 100 population) #> {NAMCS 2019 PUF} #> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ #> │ Level │ Rate │ SE │ LL │ UL │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ Under 15 years │ 202.5 │ 24.3 │ 159.8 │ 256.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 15-24 years │ 198.4 │ 21.9 │ 159.5 │ 246.8 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 25-44 years │ 263.3 │ 26.5 │ 215.9 │ 321   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 45-64 years │ 414   │ 37.7 │ 346.2 │ 495.1 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 65-74 years │ 720.3 │ 66.4 │ 600.8 │ 863.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 75 years and over │ 758.1 │ 89.2 │ 601.2 │ 956   │ #> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ #> (Checked presentation standards. Nothing to report.) #> #> Patient age recode (Patient sex = Male) (rate per 100 population) #> {NAMCS 2019 PUF} #> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ #> │ Level │ Rate │ SE │ LL │ UL │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ Under 15 years │ 187.4 │ 25   │ 144.1 │ 243.7 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 15-24 years │ 113.1 │ 20.7 │ 78.4 │ 163   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 25-44 years │ 133.4 │ 17.2 │ 103.4 │ 172   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 45-64 years │ 333.4 │ 32.3 │ 275.4 │ 403.5 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 65-74 years │ 594.8 │ 46.4 │ 510.1 │ 693.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 75 years and over │ 801.2 │ 73.2 │ 669.1 │ 959.5 │ #> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":null,"dir":"Reference","previous_headings":"","what":"Total count — total","title":"Total count — total","text":"Total count","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Total count — total","text":"","code":"total(csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Total count — total","text":"csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Total count — total","text":"table","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Total count — total","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┐ #> │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ #> ├───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ #> └───────────────┴───────────────┴───────────────┴───────────────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Overall rate — total_rate","title":"Overall rate — total_rate","text":"Overall rate","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Overall rate — total_rate","text":"","code":"total_rate( pop, per = getOption(\"surveytable.rate_per\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Overall rate — total_rate","text":"pop population per calculate rate per many items population csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Overall rate — total_rate","text":"table","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Overall rate — total_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total_rate(uspop2019$total) #> Total (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┐ #> │ Rate │ SE │ LL │ UL │ #> ├───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 320.7 │ 15.1 │ 292.4 │ 351.7 │ #> └───────────────┴───────────────┴───────────────┴───────────────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":null,"dir":"Reference","previous_headings":"","what":"US Population in 2019 — uspop2019","title":"US Population in 2019 — uspop2019","text":"Population estimates civilian non-institutional population United States July 1, 2019. Used calculating rates. usage examples, see *_rate functions.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US Population in 2019 — uspop2019","text":"","code":"uspop2019"},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US Population in 2019 — uspop2019","text":"object class list length 7.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":null,"dir":"Reference","previous_headings":"","what":"Are all the variables true? (Logical AND) — var_all","title":"Are all the variables true? (Logical AND) — var_all","text":"Create new variable true variables list variables true.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Are all the variables true? (Logical AND) — var_all","text":"","code":"var_all(newvr, vrs)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Are all the variables true? (Logical AND) — var_all","text":"newvr name new variable created vrs vector logical variables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Are all the variables true? (Logical AND) — var_all","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Are all the variables true? (Logical AND) — var_all","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_all(\"Medicare and Medicaid\", c(\"PAYMCARE\", \"PAYMCAID\")) tab(\"Medicare and Medicaid\") #> Medicare and Medicaid {NAMCS 2019 PUF} #> ┌───────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 1,016,202 │ 47,395 │ 927,389 │ 1,113,520 │ 98 │ 0.5 │ 96.9 │ 98.9 │ #> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 20,282 │ 5,177 │ 12,120 │ 33,941 │ 2 │ 0.5 │ 1.1 │ 3.1 │ #> └───────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Is any variable true? (Logical OR) — var_any","title":"Is any variable true? (Logical OR) — var_any","text":"Create new variable true variables list variables true.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is any variable true? (Logical OR) — var_any","text":"","code":"var_any(newvr, vrs)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is any variable true? (Logical OR) — var_any","text":"newvr name new variable created vrs vector logical variables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Is any variable true? (Logical OR) — var_any","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is any variable true? (Logical OR) — var_any","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_any(\"Imaging services\" , c(\"ANYIMAGE\", \"BONEDENS\", \"CATSCAN\", \"ECHOCARD\", \"OTHULTRA\" , \"MAMMO\", \"MRI\", \"XRAY\", \"OTHIMAGE\")) tab(\"Imaging services\") #> Imaging services {NAMCS 2019 PUF} #> ┌───────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 901,115 │ 43,298 │ 820,085 │ 990,151 │ 86.9 │ 1.1 │ 84.6 │ 89.1 │ #> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 135,369 │ 13,574 │ 111,134 │ 164,890 │ 13.1 │ 1.1 │ 10.9 │ 15.4 │ #> └───────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert factor to logical — var_case","title":"Convert factor to logical — var_case","text":"Convert factor logical","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert factor to logical — var_case","text":"","code":"var_case(newvr, vr, cases)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert factor to logical — var_case","text":"newvr name new logical variable created vr factor variable cases one levels vr converted TRUE. levels converted FALSE.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert factor to logical — var_case","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert factor to logical — var_case","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_case(\"Preventive care visits\", \"MAJOR\", \"Preventive care\") tab(\"Preventive care visits\") #> Preventive care visits {NAMCS 2019 PUF} #> ┌───────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 812,861 │ 45,220 │ 728,841 │ 906,566 │ 78.4 │ 1.7 │ 74.9 │ 81.7 │ #> ├───────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 223,624 │ 18,520 │ 190,068 │ 263,103 │ 21.6 │ 1.7 │ 18.3 │ 25.1 │ #> └───────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> var_case(\"Surgery-related visits\" , \"MAJOR\" , c(\"Pre-surgery\", \"Post-surgery\")) tab(\"Surgery-related visits\") #> Surgery-related visits {NAMCS 2019 PUF} #> ┌───────┬──────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 969,451 │ 47,976 │ 879,793 │ 1,068,246 │ 93.5 │ 0.8 │ 91.9 │ 94.9 │ #> ├───────┼──────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 67,034 │ 7,810 │ 53,273 │ 84,348 │ 6.5 │ 0.8 │ 5.1 │ 8.1 │ #> └───────┴──────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse factor levels — var_collapse","title":"Collapse factor levels — var_collapse","text":"Collapse two levels factor variable single level.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse factor levels — var_collapse","text":"","code":"var_collapse(vr, newlevel, oldlevels)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse factor levels — var_collapse","text":"vr factor variable newlevel name new level oldlevels vector old levels","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse factor levels — var_collapse","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse factor levels — var_collapse","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"PRIMCARE\") #> Are you the patient's primary care provider? {NAMCS 2019 PUF} #> ┌─────────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┬───────┐ #> │ Level │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ Flags │ #> │ │ (000) │ │ │ │ │ │ │ │ │ #> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Blank │ 1,150 │ 478 │ 440 │ 3,005 │ 0.1 │ 0   │ 0   │ 0.2 │ Cx │ #> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Unknown │ 39,519 │ 9,507 │ 24,520 │ 63,692 │ 3.8 │ 0.9 │ 2.3 │ 6   │ │ #> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Yes │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ │ #> ├─────────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ No │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ │ #> └─────────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┴───────┘ #> Cx: suppress count (and rate) #> var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Blank\", \"Unknown\")) tab(\"PRIMCARE\") #> Are you the patient's primary care provider? {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Unknown if │ 40,669 │ 9,479 │ 25,619 │ 64,560 │ 3.9 │ 0.9 │ 2.4 │ 6.1 │ #> │ PCP │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Yes │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ No │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":null,"dir":"Reference","previous_headings":"","what":"Copy a variable — var_copy","title":"Copy a variable — var_copy","text":"Create new variable copy another variable. can modify copy, original remains unchanged. See examples.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Copy a variable — var_copy","text":"","code":"var_copy(newvr, vr)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Copy a variable — var_copy","text":"newvr name new variable created vr variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Copy a variable — var_copy","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Copy a variable — var_copy","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_copy(\"Age group\", \"AGER\") var_collapse(\"Age group\", \"65+\", c(\"65-74 years\", \"75 years and over\")) var_collapse(\"Age group\", \"25-64\", c(\"25-44 years\", \"45-64 years\")) tab(\"AGER\", \"Age group\") #> Patient age recode {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ over │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #> #> Age group {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-64 │ 479,777 │ 32,175 │ 420,624 │ 547,247 │ 46.3 │ 1.8 │ 42.7 │ 49.9 │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65+ │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross or interact two variables — var_cross","title":"Cross or interact two variables — var_cross","text":"Create new variable interaction two variables. Also see tab_cross().","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross or interact two variables — var_cross","text":"","code":"var_cross(newvr, vr, vrby)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross or interact two variables — var_cross","text":"newvr name new variable created vr first variable vrby second variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross or interact two variables — var_cross","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross or interact two variables — var_cross","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_cross(\"Age x Sex\", \"AGER\", \"SEX\") tab(\"Age x Sex\") #> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} #> ┌───────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ #> │ years : │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years : │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years : │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years : │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years : │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ #> │ Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ #> │ over : Female │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ #> │ years : Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years : │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years : │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years : │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years : │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ #> │ Male │ │ │ │ │ │ │ │ │ #> ├───────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years and │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ #> │ over : Male │ │ │ │ │ │ │ │ │ #> └───────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert numeric to factor — var_cut","title":"Convert numeric to factor — var_cut","text":"Create new categorical variable based numeric variable.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert numeric to factor — var_cut","text":"","code":"var_cut(newvr, vr, breaks, labels)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert numeric to factor — var_cut","text":"newvr name new factor variable created vr numeric variable breaks see cut() labels see cut()","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert numeric to factor — var_cut","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert numeric to factor — var_cut","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_cut(\"Age group\" , \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\")) tab(\"Age group\") #> Age group {NAMCS 2019 PUF} #> ┌─────────────┬──────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 1 │ 31,148 │ 5,282 │ 22,269 │ 43,566 │ 3   │ 0.5 │ 2.1 │ 4.1 │ #> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 1-4 │ 38,240 │ 5,444 │ 28,864 │ 50,662 │ 3.7 │ 0.5 │ 2.7 │ 4.8 │ #> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 5-14 │ 48,529 │ 5,741 │ 38,430 │ 61,282 │ 4.7 │ 0.5 │ 3.7 │ 5.9 │ #> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-64 │ 544,632 │ 36,082 │ 478,254 │ 620,223 │ 52.5 │ 2   │ 48.6 │ 56.5 │ #> ├─────────────┼──────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65 and over │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ #> └─────────────┴──────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> (Checked presentation standards. Nothing to report.) #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":null,"dir":"Reference","previous_headings":"","what":"List variables in a survey. — var_list","title":"List variables in a survey. — var_list","text":"List variables survey.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List variables in a survey. — var_list","text":"","code":"var_list(sw = \"\", all = FALSE, csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List variables in a survey. — var_list","text":"sw starting characters variable name (case insensitive) print variables? csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List variables in a survey. — var_list","text":"table","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List variables in a survey. — var_list","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_list(\"age\") #> Variables beginning with 'age' {NAMCS 2019 PUF} #> ┌──────────┬─────────┬──────────────────────┐ #> │ Variable │ Class │ Long name │ #> ├──────────┼─────────┼──────────────────────┤ #> │ AGE │ numeric │ Patient age in years │ #> ├──────────┼─────────┼──────────────────────┤ #> │ AGER │ factor │ Patient age recode │ #> └──────────┴─────────┴──────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":null,"dir":"Reference","previous_headings":"","what":"Logical NOT — var_not","title":"Logical NOT — var_not","text":"Logical ","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Logical NOT — var_not","text":"","code":"var_not(newvr, vr)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Logical NOT — var_not","text":"newvr name new variable created vr logical variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Logical NOT — var_not","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Logical NOT — var_not","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_not(\"Private insurance not used\", \"PAYPRIV\")"},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-development-version","dir":"Changelog","previous_headings":"","what":"surveytable (development version)","title":"surveytable (development version)","text":"codebook() Improved output. Allows unweighted survey data.frame. Can set certain options using argument.","code":""},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-092","dir":"Changelog","previous_headings":"","what":"surveytable 0.9.2","title":"surveytable 0.9.2","text":"CRAN release: 2024-01-18 Addressed CRAN comments.","code":""},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-091","dir":"Changelog","previous_headings":"","what":"surveytable 0.9.1","title":"surveytable 0.9.1","text":"Initial CRAN submission.","code":""}] +[{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"begin","dir":"Articles","previous_headings":"","what":"Begin","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"Begin loading surveytable package. , print message explaining specify survey ’d like analyze. omitting message . Now, specify survey ’d like analyze. Survey info {NAMCS 2019 PUF} Check survey name, survey design variables, number observations verify looks correct.","code":"library(surveytable) set_survey(namcs2019sv)"},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"counts-and-percentages","dir":"Articles","previous_headings":"Table 1","what":"Counts and percentages","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows overall estimated count well counts percentages type doctor, physician specialty, metropolitan statistical area. variables necessary creating table already survey, making commands straightforward. Total {NAMCS 2019 PUF} Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF}","code":"total() tab(\"MDDO\", \"SPECCAT\", \"MSA\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"rates","dir":"Articles","previous_headings":"Table 1","what":"Rates","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"published table also shows several rates. calculate rates, addition survey, need source information population estimates. typically use function read.csv() load population estimates get correct format. surveytable package comes object called uspop2019 contains several population estimates use examples. overall population estimate: overall population estimate, overall rate : Total (rate per 100 population) {NAMCS 2019 PUF} calculate rates particular variable, need provide data frame variable called Level matches levels variable survey, variable called Population gives population size (assumed constant rather random variable). MSA, can see levels variables just using tab() command, just . Thus, calculate rates, need data frame follows: Now appropriate population estimates, rate : Metropolitan Statistical Area Status physician location (rate per 100 population) {NAMCS 2019 PUF} can also calculate rates specific variable based entire population: Type doctor (MD ) (rate per 100 population) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) (rate per 100 population) {NAMCS 2019 PUF}","code":"class(uspop2019) ## [1] \"list\" names(uspop2019) ## [1] \"total\" \"MSA\" \"AGER\" \"Age group\" \"SEX\" ## [6] \"AGER x SEX\" \"Age group 5\" uspop2019$total ## [1] 323186697 total_rate(uspop2019$total) uspop2019$MSA ## Level Population ## 1 MSA (Metropolitan Statistical Area) 277229518 ## 2 Non-MSA 45957179 tab_rate(\"MSA\", uspop2019$MSA) tab_rate(\"MDDO\", uspop2019$total) ## * Rate based on the entire population. tab_rate(\"SPECCAT\", uspop2019$total) ## * Rate based on the entire population."},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"counts-and-percentages-1","dir":"Articles","previous_headings":"Table 3","what":"Counts and percentages","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table presents estimates age group, well age group sex. Variables beginning ‘age’ {NAMCS 2019 PUF} survey couple relevant age-related variables. AGE patient age years. AGER categorical variable based AGE. However, table, addition AGER, need another age group variable, different age categories. create using var_cut function. Now ’ve created Age group variable, can create tables: Patient age recode {NAMCS 2019 PUF} Age group {NAMCS 2019 PUF} Patient sex {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) {NAMCS 2019 PUF}","code":"var_list(\"age\") var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) tab(\"AGER\", \"Age group\", \"SEX\") tab_cross(\"AGER\", \"SEX\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"rates-1","dir":"Articles","previous_headings":"Table 3","what":"Rates","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"Patient age recode (rate per 100 population) {NAMCS 2019 PUF} Age group (rate per 100 population) {NAMCS 2019 PUF} Patient sex (rate per 100 population) {NAMCS 2019 PUF} calculate rates one variable (AGER) another variable (SEX), need population estimates following format: population estimates, rates : Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF}","code":"tab_rate(\"AGER\", uspop2019$AGER) tab_rate(\"Age group\", uspop2019$`Age group`) ## * Population for some levels not defined: 15-64 tab_rate(\"SEX\", uspop2019$SEX) uspop2019$`AGER x SEX` ## Level Subset Population ## 1 Under 15 years Female 29604762 ## 2 15-24 years Female 20730118 ## 3 25-44 years Female 43192143 ## 4 45-64 years Female 42508901 ## 5 65-74 years Female 16673240 ## 6 75 years and over Female 12421444 ## 7 Under 15 years Male 30921894 ## 8 15-24 years Male 20988582 ## 9 25-44 years Male 42407267 ## 10 45-64 years Male 40053148 ## 11 65-74 years Male 14586962 ## 12 75 years and over Male 9098236 tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`)"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-5","dir":"Articles","previous_headings":"","what":"Table 5","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table gives expected sources payment. use PAY* variables create several new variables required table. Note PAY* variables logical (TRUE FALSE), simplifies workflow. (survey imported R using importsurvey package, automatically detects binary variables imports logical variables.) Expected source payment visit: Private insurance {NAMCS 2019 PUF} Expected source payment visit: Medicare {NAMCS 2019 PUF} Expected source payment visit: Medicaid CHIP state-based program {NAMCS 2019 PUF} Medicare Medicaid {NAMCS 2019 PUF} insurance {NAMCS 2019 PUF} Self-pay {NAMCS 2019 PUF} charge {NAMCS 2019 PUF} Expected source payment visit: Workers Compensation {NAMCS 2019 PUF} Expected source payment visit: {NAMCS 2019 PUF} Unknown blank {NAMCS 2019 PUF} Check presentation standards flags! NCHS presentation standards rules, estimates shown.","code":"# var_all(\"Medicare and Medicaid\", c(\"PAYMCARE\", \"PAYMCAID\")) # var_any(\"Payment used\", c(\"PAYPRIV\", \"PAYMCARE\", \"PAYMCAID\" , \"PAYWKCMP\", \"PAYOTH\", \"PAYDK\")) var_not(\"No other payment used\", \"Payment used\") var_all(\"Self-pay\", c(\"PAYSELF\", \"No other payment used\")) var_all(\"No charge\", c(\"PAYNOCHG\", \"No other payment used\")) var_any(\"No insurance\", c(\"Self-pay\", \"No charge\")) # var_case(\"No pay\", \"NOPAY\", \"No categories marked\") var_any(\"Unknown or blank\", c(\"PAYDK\", \"No pay\")) ## tab(\"PAYPRIV\", \"PAYMCARE\", \"PAYMCAID\", \"Medicare and Medicaid\" , \"No insurance\", \"Self-pay\", \"No charge\" , \"PAYWKCMP\", \"PAYOTH\", \"Unknown or blank\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-6","dir":"Articles","previous_headings":"","what":"Table 6","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows primary care provider referral status, prior-visit status. table, “Unknown” “Blank” values collapsed single value. can collapse two levels factor single level using var_collapse function. Now, table: patient’s primary care provider? {NAMCS 2019 PUF} patient referred visit? {NAMCS 2019 PUF} patient seen practice ? {NAMCS 2019 PUF} percentages within subset defined SENBEFOR add 100% – reason, want use tab_subset(), tab_cross(). patient’s primary care provider? (patient seen practice ? = Yes, established patient) {NAMCS 2019 PUF} patient’s primary care provider? (patient seen practice ? = , new patient) {NAMCS 2019 PUF} patient referred visit? (patient seen practice ? = Yes, established patient) {NAMCS 2019 PUF} patient referred visit? (patient seen practice ? = , new patient) {NAMCS 2019 PUF}","code":"var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Unknown\", \"Blank\")) var_collapse(\"REFER\", \"Unknown if referred\", c(\"Unknown\", \"Blank\")) tab(\"PRIMCARE\", \"REFER\", \"SENBEFOR\") tab_subset(\"PRIMCARE\", \"SENBEFOR\") tab_subset(\"REFER\", \"SENBEFOR\")"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"table-11","dir":"Articles","previous_headings":"","what":"Table 11","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"table shows information Table 3, preventive care visits. , estimates age group, well age group sex, preventive care visits. Let’s create Age group AGE cross AGER SEX create variable called Age x Sex: see possible values MAJOR (Major reason visit), estimate total count preventive care visits: Major reason visit {NAMCS 2019 PUF} create tables age, sex, interaction, limit preventive care visits: Patient age recode (Major reason visit = Preventive care) {NAMCS 2019 PUF} Age group (Major reason visit = Preventive care) {NAMCS 2019 PUF} Patient sex (Major reason visit = Preventive care) {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) (Major reason visit = Preventive care) {NAMCS 2019 PUF} commands similar, differs first variable passed tab_subset() function, code can streamlined loop: Patient age recode (Major reason visit = Preventive care) {NAMCS 2019 PUF} Age group (Major reason visit = Preventive care) {NAMCS 2019 PUF} Patient sex (Major reason visit = Preventive care) {NAMCS 2019 PUF} (Patient age recode) x (Patient sex) (Major reason visit = Preventive care) {NAMCS 2019 PUF} Note called inside loop, print() function needs called explicitly.","code":"var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) ## Warning in var_cut(\"Age group\", \"AGE\", c(-Inf, 0, 4, 14, 64, Inf), c(\"Under 1\", ## : Age group: overwriting a variable that already exists. var_cross(\"Age x Sex\", \"AGER\", \"SEX\") tab(\"MAJOR\") tab_subset(\"AGER\", \"MAJOR\", \"Preventive care\") tab_subset(\"Age group\", \"MAJOR\", \"Preventive care\") tab_subset(\"SEX\", \"MAJOR\", \"Preventive care\") tab_subset(\"Age x Sex\", \"MAJOR\", \"Preventive care\") for (vr in c(\"AGER\", \"Age group\", \"SEX\", \"Age x Sex\")) { print( tab_subset(vr, \"MAJOR\", \"Preventive care\") ) }"},{"path":"https://cdcgov.github.io/surveytable/articles/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.html","id":"more-advanced-coding","dir":"Articles","previous_headings":"Table 11","what":"More advanced coding","title":"Example: National Ambulatory Medical Care Survey (NAMCS) tables","text":"addition, age-sex category, published table shows percentage preventive care visits made primary care physicians. calculate percentages, slightly involved loop needed. code, followed explanation: Since tab_subset() called within loop, wanted print screen, need use print( tab_subset(*) ). Since don’t want print screen, call print() omitted. Since many tables produced, output sent CSV file. , loop goes age, sex, age / sex interaction variables, calling variables vr. MAJOR vr crossed, result stored variable called tmp. Next, inner loop goes levels vr, calling levels lvl. code tabulates SPECCAT (Type specialty – Primary, Medical, Surgical) subset tmp (MAJOR crossed vr) restricted \"Preventive care: \" followed lvl, level vr, “15 years” AGER. Finally, CSV output turned . run code, tables stored CSV file. give idea tables look like, just one tables: Type specialty (Primary, Medical, Surgical) ((Major reason visit) x (Patient age recode) = Preventive care: 15 years) {NAMCS 2019 PUF} match percentage published table, see “Primary care specialty” row. sure check presentation standards flags.","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) for (vr in c(\"AGER\", \"Age group\", \"SEX\", \"Age x Sex\")) { var_cross(\"tmp\", \"MAJOR\", vr) for (lvl in levels(surveytable:::env$survey$variables[,vr])) { tab_subset(\"SPECCAT\", \"tmp\", paste0(\"Preventive care: \", lvl)) } } ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. set_output(csv = \"\") ## * Turning off CSV output. ## * ?set_output for other options. vr = \"AGER\" var_cross(\"tmp\", \"MAJOR\", vr) ## Warning in var_cross(\"tmp\", \"MAJOR\", vr): tmp: overwriting a variable that ## already exists. lvl = levels(surveytable:::env$survey$variables[,vr])[1] tab_subset(\"SPECCAT\", \"tmp\", paste0(\"Preventive care: \", lvl))"},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"concepts","dir":"Articles","previous_headings":"Preliminaries","what":"Concepts","title":"Introduction to surveytable","text":"two important concepts need learn distinguish: data frame standard way storing data R. data frame rectangular data. Variables columns, observations rows. Example: data frame, , represent complex survey. , just looking data frame, R know sampling weights , strata , etc. Even variables represent sampling weights, etc, part data frame, just looking data frame, R know variable represents weights survey design variables. can get data frame R many different ways. data currently comma-separated values (CSV) file, can use read.csv(). ’s SAS file, can use package like haven importsurvey. ’s already R format, use readRDS(), . survey object object describes survey. tells R sampling weights , strata , . data frame can converted survey object using survey::svydesign() function; survey uses replicate weights, survey::svrepdesign() function used. Generally speaking, need convert data frame survey object . converted, can save saveRDS() (similar). future, can load readRDS(). need re-convert data frame survey object every time.","code":"head(iris) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"namcs","dir":"Articles","previous_headings":"Preliminaries","what":"NAMCS","title":"Introduction to surveytable","text":"Examples tutorial use survey called National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF). NAMCS “annual nationally representative sample survey visits non-federal office-based patient care physicians, excluding anesthesiologists, radiologists, pathologists.” Note unit observation visits, patients – distinction important since single patient can make multiple visits. surveytable package comes data frame selected variables NAMCS, called namcs2019sv_df (sv = selected variables; df = data frame). survey object survey called namcs2019sv. namcs2019sv object analyze. really need namcs2019sv. reason package namcs2019sv_df illustrate convert data frame survey object.","code":""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"more-concepts","dir":"Articles","previous_headings":"Preliminaries","what":"More concepts","title":"Introduction to surveytable","text":"importing data another source, SAS CSV, analysts aware standard way variables handled R. Specifically, categorical variables stored factor. true / false variables stored factor well, programming tasks easier stored logical. Unknown values stored missing (NA). variable contains “special values”, negative value indicating age missing, “special values” need converted NA. Variables namcs2019sv_df already stored correctly. Thus, AGER (patient’s age group) factor variable; PAYNOCHG (indicates whether charge physician visit) logical variable; AGE (patient’s age years) numeric variable.","code":"library(\"surveytable\") class(namcs2019sv_df$AGER) #> [1] \"factor\" class(namcs2019sv_df$PAYNOCHG) #> [1] \"logical\" class(namcs2019sv_df$AGE) #> [1] \"numeric\""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"create-a-survey-object","dir":"Articles","previous_headings":"Preliminaries","what":"Create a survey object","title":"Introduction to surveytable","text":"seen , tables produced surveytable clearer either variable names descriptive, variables \"label\" attribute descriptive. namcs2019sv_df, variables already \"label\" attribute set. example, variable name AGE descriptive, variable descriptive \"label\" attribute: Documentation NAMCS survey provides names survey design variables. Specifically, NAMCS, cluster ID’s, also known primary sampling units (PSU’s), given CPSUM; strata given CSTRATM; sampling weights given PATWT. Thus, namcs2019sv_df data frame can turned survey object follows: Tables produced surveytable clearer either name survey object descriptive, object \"label\" attribute descriptive. Let’s set attribute mysurvey: mysurvey object now identical namcs2019sv. Let’s verify : just successfully created survey object data frame.","code":"attr(namcs2019sv_df$AGE, \"label\") #> [1] \"Patient age in years\" mysurvey = survey::svydesign(ids = ~ CPSUM , strata = ~ CSTRATM , weights = ~ PATWT , data = namcs2019sv_df) attr(mysurvey, \"label\") = \"NAMCS 2019 PUF\" identical(namcs2019sv, mysurvey) #> [1] TRUE"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"begin-analysis","dir":"Articles","previous_headings":"","what":"Begin analysis","title":"Introduction to surveytable","text":"First, specify survey object ’d like analyze. Survey info {NAMCS 2019 PUF} Check survey label, survey design variables, number observations verify looks correct.","code":"set_survey(namcs2019sv)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"list-variables","dir":"Articles","previous_headings":"Begin analysis","what":"List variables","title":"Introduction to surveytable","text":"var_list() function lists variables survey. avoid unintentionally listing variables survey, can many, starting characters variable names specified. example, list variables start letters age, type: Variables beginning ‘age’ {NAMCS 2019 PUF} table lists variable name; class, type variable; variable label, long name variable. Common classes factor (categorical variable), logical (yes / variable), numeric.","code":"var_list(\"age\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"tabulate-categorical-and-logical-variables","dir":"Articles","previous_headings":"","what":"Tabulate categorical and logical variables","title":"Introduction to surveytable","text":"main function surveytable package tab(), tabulates variables. operates categorical logical variables, presents estimated counts, standard errors (SEs) 95% confidence intervals (CIs), percentages, SEs CIs. example, tabulate AGER, type: Patient age recode {NAMCS 2019 PUF} table title shows variable label (long variable name) survey label. level variable, table shows: estimated count, standard error, 95% confidence interval; estimated percentage, standard error, 95% confidence interval. NCHS presentation standards. tab() function also applies National Center Health Statistics (NCHS) presentation standards counts percentages, flags estimates , according standards, suppressed, footnoted, reviewed analyst. CIs displayed ones used NCHS presentation standards. Specifically, counts, tables show log Student’s t 95% CI, adaptations complex surveys; percentages, show 95% Korn Graubard CI. One need anything extra perform presentation standards checking – performed automatically. example, let’s tabulate PAYNOCHG: Expected source payment visit: Charge/Charity {NAMCS 2019 PUF} table tells us , according NCHS presentation standards, estimated number visits charge visit suppressed due low precision. However, lack percentage flag indicates estimated percentage visits can shown. Drop missing values. variables might contain missing values (NA). Consider following variable, part actual survey, constructed specifically example: Type specialty (BAD - use) {NAMCS 2019 PUF} calculate percentages based non-missing values , use drop_na argument: Type specialty (BAD - use) (knowns ) {NAMCS 2019 PUF} table gives percentages based knowns, , based non-NA values. Multiple tables. Multiple tables can created single command: Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF}","code":"tab(\"AGER\") tab(\"PAYNOCHG\") tab(\"SPECCAT.bad\") tab(\"SPECCAT.bad\", drop_na = TRUE) tab(\"MDDO\", \"SPECCAT\", \"MSA\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"entire-population","dir":"Articles","previous_headings":"Tabulate categorical and logical variables","what":"Entire population","title":"Introduction to surveytable","text":"Estimate total count entire population using total() command: Total {NAMCS 2019 PUF}","code":"total()"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"subsets-or-interactions","dir":"Articles","previous_headings":"Tabulate categorical and logical variables","what":"Subsets or interactions","title":"Introduction to surveytable","text":"create table AGER value variable SEX, type: Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} addition giving long name variable tabulated, title table reflects value subsetting variable (case, either Female Male). tab_subset() command, table (, subset), percentages add 100%. tab_cross() function similar – crosses interacts two variables generates table using new variable. Thus, create table interaction AGER SEX, type: (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} estimated counts produced tab_subset() tab_cross() , percentages different. tab_subset() command, within table (, within subset), percentages add 100%. hand, tab_cross(), percentages across entire population add 100%.","code":"tab_subset(\"AGER\", \"SEX\") tab_cross(\"AGER\", \"SEX\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"tabulate-numeric-variables","dir":"Articles","previous_headings":"","what":"Tabulate numeric variables","title":"Introduction to surveytable","text":"tab() tab_subset() functions also work numeric variables, though variables, output different. tabulate NUMMED (number medications), numeric variable, type: Number medications coded {NAMCS 2019 PUF} , table title shows variable label (long variable name) survey label. table shows percentage values missing (NA), mean, standard error mean (SEM), standard deviation (SD). Subsetting works : Number medications coded (different levels Patient age recode) {NAMCS 2019 PUF}","code":"tab(\"NUMMED\") tab_subset(\"NUMMED\", \"AGER\")"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"perform-statistical-hypothesis-testing","dir":"Articles","previous_headings":"","what":"Perform statistical hypothesis testing","title":"Introduction to surveytable","text":"tab_subset() function makes easy perform hypothesis testing using test argument. argument TRUE, test association performed. addition, t-tests pairs levels performed well.","code":""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"categorical-variables","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Categorical variables","title":"Introduction to surveytable","text":"Consider relationship AGER SPECCAT: Patient age recode (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Patient age recode (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Patient age recode (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Association Patient age recode Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Patient age recode (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 15 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 15-24 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 25-44 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 45-64 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 65-74 years) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (Patient age recode = 75 years ) {NAMCS 2019 PUF} According tables, association physician specialty type patient age. instance, patients 15 years, statistical difference primary care physician specialty medical care specialty. older patients, 45-64 age group, statistical difference two specialty types. another example, consider relationship MRI SPECCAT: MRI (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} MRI (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} MRI (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Association MRI Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Primary care specialty) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Surgical care specialty) {NAMCS 2019 PUF} Comparison possible pairs MRI (Type specialty (Primary, Medical, Surgical) = Medical care specialty) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (MRI = FALSE) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) (MRI = TRUE) {NAMCS 2019 PUF} According tables, statistical association MRI physician specialty. 3 specialty types, minority visits MRI’s. visits MRI’s, statistical difference specialty types. general rule thumb, since statistical association MRI physician specialty, presenting tabulation particularly interesting, especially since subsetting decreases sample size therefore also decreases estimate reliability. Instead, generally make sense just tabulate MRI without subsetting SPECCAT.","code":"tab_subset(\"AGER\", \"SPECCAT\", test = TRUE) tab_subset(\"MRI\", \"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"numeric-variables","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Numeric variables","title":"Introduction to surveytable","text":"relationship NUMMED AGER: Number medications coded (different levels Patient age recode) {NAMCS 2019 PUF} Association Number medications coded Patient age recode {NAMCS 2019 PUF} Comparison Number medications coded across possible pairs Patient age recode {NAMCS 2019 PUF} According tables, association number medications age category. NUMMED statistically similar “15 years” “15-24 years” AGER categories. statistically different pairs age categories. Finally, let’s look relationship NUMMED SPECCAT: Number medications coded (different levels Type specialty (Primary, Medical, Surgical)) {NAMCS 2019 PUF} Association Number medications coded Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison Number medications coded across possible pairs Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} According tables, association number medications physician specialty type. NUMMED statistically similar pairs physician specialties. general rule thumb, since statistical association number medications physician specialty, presenting tabulation particularly interesting, especially since subsetting decreases sample size therefore also decreases estimate reliability. Instead, generally make sense just tabulate NUMMED without subsetting SPECCAT.","code":"tab_subset(\"NUMMED\", \"AGER\", test = TRUE) tab_subset(\"NUMMED\", \"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"categorical-variables-single-variable","dir":"Articles","previous_headings":"Perform statistical hypothesis testing","what":"Categorical variables (single variable)","title":"Introduction to surveytable","text":"test whether pair SPECCAT levels statistically similar different, type: Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Comparison possible pairs Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} According , surgical medical care specialties statistically similar, statistically different primary care.","code":"tab(\"SPECCAT\", test = TRUE)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"calculate-rates","dir":"Articles","previous_headings":"","what":"Calculate rates","title":"Introduction to surveytable","text":"rate ratio count estimates based survey question divided population size, assumed known. example, number physician visits per 100 people population rate: number physician visits estimated namcs2019sv survey, number people population comes another source. calculate rates, addition survey, need source information population size. typically use function read.csv() load population figures get correct format. surveytable package comes object called uspop2019 contains several population figures use examples. Let’s examine uspop2019: overall population size country whole : overall population size, overall rate : Total (rate per 100 population) {NAMCS 2019 PUF} calculate rates particular variable, need provide data frame column called Level matches levels variable survey, column called Population gives size population level. example, AGER, data frame follows: Now appropriate population figures, rates table obtained typing: Patient age recode (rate per 100 population) {NAMCS 2019 PUF} calculate rates one variable (AGER) another variable (SEX), need population figures following format: data frame, rates table obtained typing: Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF}","code":"class(uspop2019) #> [1] \"list\" names(uspop2019) #> [1] \"total\" \"MSA\" \"AGER\" \"Age group\" \"SEX\" #> [6] \"AGER x SEX\" \"Age group 5\" uspop2019$total #> [1] 323186697 total_rate(uspop2019$total) uspop2019$AGER #> Level Population #> 1 Under 15 years 60526656 #> 2 15-24 years 41718700 #> 3 25-44 years 85599410 #> 4 45-64 years 82562049 #> 5 65-74 years 31260202 #> 6 75 years and over 21519680 tab_rate(\"AGER\", uspop2019$AGER) uspop2019$`AGER x SEX` #> Level Subset Population #> 1 Under 15 years Female 29604762 #> 2 15-24 years Female 20730118 #> 3 25-44 years Female 43192143 #> 4 45-64 years Female 42508901 #> 5 65-74 years Female 16673240 #> 6 75 years and over Female 12421444 #> 7 Under 15 years Male 30921894 #> 8 15-24 years Male 20988582 #> 9 25-44 years Male 42407267 #> 10 45-64 years Male 40053148 #> 11 65-74 years Male 14586962 #> 12 75 years and over Male 9098236 tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`)"},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"create-or-modify-variables","dir":"Articles","previous_headings":"","what":"Create or modify variables","title":"Introduction to surveytable","text":"situations, might necessary modify survey variables, create new ones. section describes . Convert factor logical. variable MAJOR (major reason visit) several levels. Major reason visit {NAMCS 2019 PUF} Notice one levels called \"Preventive care\". Suppose analyst interested whether visit preventive care visit – interested visit types. can create new variable called Preventive care visits TRUE preventive care visits FALSE types visits, follows: Preventive care visits {NAMCS 2019 PUF} creates logical variable TRUE preventive care visits tabulates . using var_case() function, specify name new logical variable created, existing factor variable, one levels factor variable set TRUE logical variable. Thus, analyst interested surgery-related visits, indicated two different levels MAJOR, type: Surgery-related visits {NAMCS 2019 PUF} Collapse levels. variable PRIMCARE (whether physician patient’s primary care provider) levels Unknown Blank, among others. patient’s primary care provider? {NAMCS 2019 PUF} collapse Unknown Blank single level, type: patient’s primary care provider? {NAMCS 2019 PUF} Convert numeric factor. variable AGE numeric. Patient age years {NAMCS 2019 PUF} create new variable age categories based AGE, type: Age group {NAMCS 2019 PUF} var_cut() command, specify following information: name new categorical variable; name existing numeric variable; cut points – note intervals inclusive right; category labels. Check whether variable true. series logical variables, can check whether TRUE using var_any() command. physician visit considered “imaging services” visit number imaging services ordered provided. Imaging services indicated using logical variables, MRI XRAY. create Imaging services variable, type: Imaging services {NAMCS 2019 PUF} Interact variables. tab_cross() function creates table interaction two variables, save interacted variable. create interacted variable, use var_cross() command: Specify name new variable well names two variables interact. Copy variable. Create new variable copy another variable using var_copy(). can modify copy, original remains unchanged. example: Patient age recode {NAMCS 2019 PUF} Age group {NAMCS 2019 PUF} , AGER variable remains unchanged, Age group variable fewer categories. variables data frame. Recall survey objects element called variables, data frame contains survey variables. advanced users can create modify variables variables data frame directly. modify variables, must call set_survey() . example: Survey info {NAMCS 2019 PUF} Medicare Medicaid {NAMCS 2019 PUF} Note, however, var_*() functions modify survey object specified set_survey() directly. Rather, modify variables inside following data frame: surveytable:::env$survey$variables. use var_*() functions need access modified / created variables, ’s look. example:","code":"tab(\"MAJOR\") var_case(\"Preventive care visits\", \"MAJOR\", \"Preventive care\") tab(\"Preventive care visits\") var_case(\"Surgery-related visits\" , \"MAJOR\" , c(\"Pre-surgery\", \"Post-surgery\")) tab(\"Surgery-related visits\") tab(\"PRIMCARE\") var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Unknown\", \"Blank\")) tab(\"PRIMCARE\") tab(\"AGE\") var_cut(\"Age group\", \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\") ) tab(\"Age group\") var_any(\"Imaging services\" , c(\"ANYIMAGE\", \"BONEDENS\", \"CATSCAN\", \"ECHOCARD\", \"OTHULTRA\" , \"MAMMO\", \"MRI\", \"XRAY\", \"OTHIMAGE\")) tab(\"Imaging services\") var_cross(\"Age x Sex\", \"AGER\", \"SEX\") var_copy(\"Age group\", \"AGER\") #> Warning in var_copy(\"Age group\", \"AGER\"): Age group: overwriting a variable #> that already exists. var_collapse(\"Age group\", \"65+\", c(\"65-74 years\", \"75 years and over\")) var_collapse(\"Age group\", \"25-64\", c(\"25-44 years\", \"45-64 years\")) tab(\"AGER\", \"Age group\") class(namcs2019sv$variables) #> [1] \"data.frame\" namcs2019sv$variables$`Medicare and Medicaid` = ( namcs2019sv$variables$PAYMCARE & namcs2019sv$variables$PAYMCAID) set_survey(namcs2019sv) tab(\"Medicare and Medicaid\") var_cross(\"newvar\", \"MAJOR\", \"AGER\") # This should give NULL. The new variable does not exist here: namcs2019sv$variables$newvar #> NULL # Rather, the new variable is here: str(surveytable:::env$survey$variables$newvar) #> Factor w/ 42 levels \"Blank: Under 15 years\",..: 17 31 24 38 38 24 30 31 24 38 ... #> - attr(*, \"label\")= chr \"(Major reason for this visit) x (Patient age recode)\""},{"path":"https://cdcgov.github.io/surveytable/articles/surveytable.html","id":"save-the-output","dir":"Articles","previous_headings":"","what":"Save the output","title":"Introduction to surveytable","text":"tab* total* functions argument called csv specifies name comma-separated values (CSV) file save output . Alternatively, can name default CSV output file using set_output() function. example, following directs surveytable send future output CSV file, create tables, turn sending output file: Type doctor (MD ) {NAMCS 2019 PUF} Type specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} Metropolitan Statistical Area Status physician location {NAMCS 2019 PUF} tabulation functions called within R Markdown notebook, produce HTML tables. makes easy incorporate output surveytable package directly documents, presentations, “shiny” web apps, output types. Finally, tabulation functions return tables produce. advanced analysts can use functionality integrate surveytable programming tasks.","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) tab(\"MDDO\", \"SPECCAT\", \"MSA\") set_output(csv = \"\") #> * Turning off CSV output. #> * ?set_output for other options."},{"path":"https://cdcgov.github.io/surveytable/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Alex Strashny. Author, maintainer.","code":""},{"path":"https://cdcgov.github.io/surveytable/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Strashny (2023). surveytable: Formatted Survey Estimates. https://cdcgov.github.io/surveytable/, https://github.com/CDCgov/surveytable.","code":"@Manual{, title = {surveytable: Formatted Survey Estimates}, author = {Alex Strashny}, year = {2023}, note = {https://cdcgov.github.io/surveytable/, https://github.com/CDCgov/surveytable}, }"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"survey-table-formatted-survey-estimates","dir":"","previous_headings":"","what":"Formatted Survey Estimates","title":"Formatted Survey Estimates","text":"surveytable package provides short understandable commands generate tabulated, formatted, rounded survey estimates. One useful function, operates categorical logical variables, tabulates estimated counts percentages standard errors confidence intervals. functions list variables survey, estimate total population, tabulate survey subsets variable interactions, tabulate numeric variables, tabulate rates, create modify survey variables, perform hypothesis tests, save output. tabulation functions check National Center Health Statistics (NCHS) presentation standards flag low-precision estimates. surveytable code called R Markdown notebook Quarto document, generates HTML tables, can incorporated directly documents.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Formatted Survey Estimates","text":"Install CRAN: get development version GitHub:","code":"install.packages(\"surveytable\") install.packages(c(\"remotes\", \"git2r\")) remotes::install_github(\"CDCgov/surveytable\", upgrade = \"never\")"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"Formatted Survey Estimates","text":"Find documentation surveytable : https://cdcgov.github.io/surveytable/","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Formatted Survey Estimates","text":"basic example, get started. Survey info {NAMCS 2019 PUF} Patient age recode {NAMCS 2019 PUF}","code":"library(surveytable) set_survey(namcs2019sv) tab(\"AGER\")"},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"public-domain-standard-notice","dir":"","previous_headings":"","what":"Public Domain Standard Notice","title":"Formatted Survey Estimates","text":"repository constitutes work United States Government subject domestic copyright protection 17 USC § 105. repository public domain within United States, copyright related rights work worldwide waived CC0 1.0 Universal public domain dedication. contributions repository released CC0 dedication. submitting pull request agreeing comply waiver copyright interest.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"license-standard-notice","dir":"","previous_headings":"","what":"License Standard Notice","title":"Formatted Survey Estimates","text":"repository utilizes code licensed terms Apache Software License therefore licensed ASL v2 later. source code repository free: can redistribute /modify terms Apache Software License version 2, (option) later version. source code repository distributed hope useful, WITHOUT WARRANTY; without even implied warranty MERCHANTABILITY FITNESS PARTICULAR PURPOSE. See Apache Software License details. received copy Apache Software License along program. , see https://www.apache.org/licenses/LICENSE-2.0.html source code forked open source projects inherit license.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"privacy-standard-notice","dir":"","previous_headings":"","what":"Privacy Standard Notice","title":"Formatted Survey Estimates","text":"repository contains non-sensitive, publicly available data information. material community participation covered Disclaimer Code Conduct. information CDC’s privacy policy, please visit https://www.cdc.gov//privacy.html.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"contributing-standard-notice","dir":"","previous_headings":"","what":"Contributing Standard Notice","title":"Formatted Survey Estimates","text":"Anyone encouraged contribute repository forking submitting pull request. (new GitHub, might start basic tutorial.) contributing project, grant world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license users terms Apache Software License v2 later. comments, messages, pull requests, submissions received CDC including GitHub page may subject applicable federal law, including limited Federal Records Act, may archived. Learn https://www.cdc.gov//privacy.html.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"records-management-standard-notice","dir":"","previous_headings":"","what":"Records Management Standard Notice","title":"Formatted Survey Estimates","text":"repository source government records, copy increase collaboration collaborative potential. government records published CDC web site.","code":""},{"path":"https://cdcgov.github.io/surveytable/index.html","id":"additional-standard-notices","dir":"","previous_headings":"","what":"Additional Standard Notices","title":"Formatted Survey Estimates","text":"Please refer CDC’s Template Repository information contributing repository, public domain notices disclaimers, code conduct.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"Apache License","title":"Apache License","text":"Version 2.0, January 2004 ","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_1-definitions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"1. Definitions","title":"Apache License","text":"“License” shall mean terms conditions use, reproduction, distribution defined Sections 1 9 document. “Licensor” shall mean copyright owner entity authorized copyright owner granting License. “Legal Entity” shall mean union acting entity entities control, controlled , common control entity. purposes definition, “control” means () power, direct indirect, cause direction management entity, whether contract otherwise, (ii) ownership fifty percent (50%) outstanding shares, (iii) beneficial ownership entity. “” (“”) shall mean individual Legal Entity exercising permissions granted License. “Source” form shall mean preferred form making modifications, including limited software source code, documentation source, configuration files. “Object” form shall mean form resulting mechanical transformation translation Source form, including limited compiled object code, generated documentation, conversions media types. “Work” shall mean work authorship, whether Source Object form, made available License, indicated copyright notice included attached work (example provided Appendix ). “Derivative Works” shall mean work, whether Source Object form, based (derived ) Work editorial revisions, annotations, elaborations, modifications represent, whole, original work authorship. purposes License, Derivative Works shall include works remain separable , merely link (bind name) interfaces , Work Derivative Works thereof. “Contribution” shall mean work authorship, including original version Work modifications additions Work Derivative Works thereof, intentionally submitted Licensor inclusion Work copyright owner individual Legal Entity authorized submit behalf copyright owner. purposes definition, “submitted” means form electronic, verbal, written communication sent Licensor representatives, including limited communication electronic mailing lists, source code control systems, issue tracking systems managed , behalf , Licensor purpose discussing improving Work, excluding communication conspicuously marked otherwise designated writing copyright owner “Contribution.” “Contributor” shall mean Licensor individual Legal Entity behalf Contribution received Licensor subsequently incorporated within Work.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_2-grant-of-copyright-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"2. Grant of Copyright License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable copyright license reproduce, prepare Derivative Works , publicly display, publicly perform, sublicense, distribute Work Derivative Works Source Object form.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_3-grant-of-patent-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"3. Grant of Patent License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable (except stated section) patent license make, made, use, offer sell, sell, import, otherwise transfer Work, license applies patent claims licensable Contributor necessarily infringed Contribution(s) alone combination Contribution(s) Work Contribution(s) submitted. institute patent litigation entity (including cross-claim counterclaim lawsuit) alleging Work Contribution incorporated within Work constitutes direct contributory patent infringement, patent licenses granted License Work shall terminate date litigation filed.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_4-redistribution","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"4. Redistribution","title":"Apache License","text":"may reproduce distribute copies Work Derivative Works thereof medium, without modifications, Source Object form, provided meet following conditions: () must give recipients Work Derivative Works copy License; (b) must cause modified files carry prominent notices stating changed files; (c) must retain, Source form Derivative Works distribute, copyright, patent, trademark, attribution notices Source form Work, excluding notices pertain part Derivative Works; (d) Work includes “NOTICE” text file part distribution, Derivative Works distribute must include readable copy attribution notices contained within NOTICE file, excluding notices pertain part Derivative Works, least one following places: within NOTICE text file distributed part Derivative Works; within Source form documentation, provided along Derivative Works; , within display generated Derivative Works, wherever third-party notices normally appear. contents NOTICE file informational purposes modify License. may add attribution notices within Derivative Works distribute, alongside addendum NOTICE text Work, provided additional attribution notices construed modifying License. may add copyright statement modifications may provide additional different license terms conditions use, reproduction, distribution modifications, Derivative Works whole, provided use, reproduction, distribution Work otherwise complies conditions stated License.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_5-submission-of-contributions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"5. Submission of Contributions","title":"Apache License","text":"Unless explicitly state otherwise, Contribution intentionally submitted inclusion Work Licensor shall terms conditions License, without additional terms conditions. Notwithstanding , nothing herein shall supersede modify terms separate license agreement may executed Licensor regarding Contributions.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_6-trademarks","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"6. Trademarks","title":"Apache License","text":"License grant permission use trade names, trademarks, service marks, product names Licensor, except required reasonable customary use describing origin Work reproducing content NOTICE file.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_7-disclaimer-of-warranty","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"7. Disclaimer of Warranty","title":"Apache License","text":"Unless required applicable law agreed writing, Licensor provides Work (Contributor provides Contributions) “” BASIS, WITHOUT WARRANTIES CONDITIONS KIND, either express implied, including, without limitation, warranties conditions TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS PARTICULAR PURPOSE. solely responsible determining appropriateness using redistributing Work assume risks associated exercise permissions License.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_8-limitation-of-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"8. Limitation of Liability","title":"Apache License","text":"event legal theory, whether tort (including negligence), contract, otherwise, unless required applicable law (deliberate grossly negligent acts) agreed writing, shall Contributor liable damages, including direct, indirect, special, incidental, consequential damages character arising result License use inability use Work (including limited damages loss goodwill, work stoppage, computer failure malfunction, commercial damages losses), even Contributor advised possibility damages.","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"id_9-accepting-warranty-or-additional-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"9. Accepting Warranty or Additional Liability","title":"Apache License","text":"redistributing Work Derivative Works thereof, may choose offer, charge fee , acceptance support, warranty, indemnity, liability obligations /rights consistent License. However, accepting obligations, may act behalf sole responsibility, behalf Contributor, agree indemnify, defend, hold Contributor harmless liability incurred , claims asserted , Contributor reason accepting warranty additional liability. END TERMS CONDITIONS","code":""},{"path":"https://cdcgov.github.io/surveytable/LICENSE.html","id":"appendix-how-to-apply-the-apache-license-to-your-work","dir":"","previous_headings":"","what":"APPENDIX: How to apply the Apache License to your work","title":"Apache License","text":"apply Apache License work, attach following boilerplate notice, fields enclosed brackets [] replaced identifying information. (Don’t include brackets!) text enclosed appropriate comment syntax file format. also recommend file class name description purpose included “printed page” copyright notice easier identification within third-party archives.","code":"Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a codebook for the survey — codebook","title":"Create a codebook for the survey — codebook","text":"Create codebook survey","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a codebook for the survey — codebook","text":"","code":"codebook(all = FALSE, csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a codebook for the survey — codebook","text":"tabulate variables? csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a codebook for the survey — codebook","text":"list tables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/codebook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a codebook for the survey — codebook","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> codebook() #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> #> Codebook {NAMCS 2019 PUF} #> ┌──────────┬─────────────┬───────────────────────┬─────────┬─────────────┬───────────────────────┐ #> │ Item no. │ Variable │ Description │ Class │ Missing (%) │ Values │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 1 │ CPSUM │ Masked provider │ numeric │ 0 │ 100001 - 100398 │ #> │ │ │ marker │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 2 │ CSTRATM │ Masked sampling │ numeric │ 0 │ 10119101 - 10419115 │ #> │ │ │ stratum from which │ │ │ │ #> │ │ │ provider was selected │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 3 │ PATWT │ Patient visit weight │ numeric │ 0 │ 7064.00718 - │ #> │ │ │ used for national and │ │ │ 1120996.55599 │ #> │ │ │ subnational estimates │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 4 │ MDDO │ Type of doctor (MD or │ factor │ 0 │ M.D. - Doctor of │ #> │ │ │ DO) │ │ │ Medicine, D.O. - │ #> │ │ │ │ │ │ Doctor of Osteopathy │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 5 │ SPECCAT │ Type of specialty │ factor │ 0 │ Primary care │ #> │ │ │ (Primary, Medical, │ │ │ specialty, Surgical │ #> │ │ │ Surgical) │ │ │ care specialty, │ #> │ │ │ │ │ │ Medical care │ #> │ │ │ │ │ │ specialty │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 6 │ MSA │ Metropolitan │ factor │ 0 │ MSA (Metropolitan │ #> │ │ │ Statistical Area │ │ │ Statistical Area), │ #> │ │ │ Status of physician │ │ │ Non-MSA │ #> │ │ │ location │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 7 │ AGER │ Patient age recode │ factor │ 0 │ Under 15 years, 15-24 │ #> │ │ │ │ │ │ years, 25-44 years, │ #> │ │ │ │ │ │ 45-64 years, 65-74 │ #> │ │ │ │ │ │ years, 75 years and │ #> │ │ │ │ │ │ over │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 8 │ SEX │ Patient sex │ factor │ 0 │ Female, Male │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 9 │ AGE │ Patient age in years │ numeric │ 0 │ 0 - 94 │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 10 │ NOPAY │ Expected source of │ factor │ 0 │ One or more │ #> │ │ │ payment for visit: No │ │ │ categories marked, No │ #> │ │ │ answer to item │ │ │ categories marked │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 11 │ PAYPRIV │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Private insurance │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 12 │ PAYMCARE │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Medicare │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 13 │ PAYMCAID │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Medicaid or CHIP or │ │ │ │ #> │ │ │ other state-based │ │ │ │ #> │ │ │ program │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 14 │ PAYWKCMP │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Workers Compensation │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 15 │ PAYOTH │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Other │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 16 │ PAYDK │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Unknown │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 17 │ PAYSELF │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: │ │ │ │ #> │ │ │ Self-pay │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 18 │ PAYNOCHG │ Expected source of │ logical │ 0 │ │ #> │ │ │ payment for visit: No │ │ │ │ #> │ │ │ Charge/Charity │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 19 │ PRIMCARE │ Are you the patient's │ factor │ 0 │ Blank, Unknown, Yes, │ #> │ │ │ primary care │ │ │ No │ #> │ │ │ provider? │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 20 │ REFER │ Was patient referred │ factor │ 0 │ Blank, Unknown, Not │ #> │ │ │ for visit? │ │ │ applicable, Yes, No │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 21 │ SENBEFOR │ Has this patient been │ factor │ 0 │ Yes, established │ #> │ │ │ seen in your practice │ │ │ patient, No, new │ #> │ │ │ before? │ │ │ patient │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 22 │ MAJOR │ Major reason for this │ factor │ 0 │ Blank, New problem │ #> │ │ │ visit │ │ │ (less than 3 mos. │ #> │ │ │ │ │ │ onset), Chronic │ #> │ │ │ │ │ │ problem, routine, │ #> │ │ │ │ │ │ Chronic problem, │ #> │ │ │ │ │ │ flare-up, │ #> │ │ │ │ │ │ Pre-surgery, │ #> │ │ │ │ │ │ Post-surgery, │ #> │ │ │ │ │ │ Preventive care │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 23 │ NUMMED │ Number of medications │ numeric │ 0 │ 0 - 30 │ #> │ │ │ coded │ │ │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 24 │ ANYIMAGE │ Any imaging │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 25 │ BONEDENS │ Bone mineral density │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 26 │ CATSCAN │ CT Scan │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 27 │ ECHOCARD │ Echocardiogram │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 28 │ OTHULTRA │ Ultrasound │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 29 │ MAMMO │ Mammography │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 30 │ MRI │ MRI │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 31 │ XRAY │ X-ray │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 32 │ OTHIMAGE │ Other imaging │ logical │ 0 │ │ #> ├──────────┼─────────────┼───────────────────────┼─────────┼─────────────┼───────────────────────┤ #> │ 33 │ SPECCAT.bad │ Type of specialty │ factor │ 20 │ Primary care │ #> │ │ │ (BAD - do not use) │ │ │ specialty, Surgical │ #> │ │ │ │ │ │ care specialty, │ #> │ │ │ │ │ │ Medical care │ #> │ │ │ │ │ │ specialty │ #> └──────────┴─────────────┴───────────────────────┴─────────┴─────────────┴───────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":null,"dir":"Reference","previous_headings":"","what":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"Selected variables data system visits office-based physicians. Note unit observation visits, patients - distinction important since single patient can make multiple visits.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"","code":"namcs2019sv namcs2019sv_df"},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"object class survey.design2 (inherits survey.design) 8250 rows 33 columns. object class data.frame 8250 rows 33 columns.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"SAS data: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/namcs2019_sas.zip Survey design variables: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/readme2019-sas.txt SAS formats: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas/nam19for.txt Documentation: https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/doc2019-508.pdf National Summary Tables: https://www.cdc.gov/nchs/data/ahcd/namcs_summary/2019-namcs-web-tables-508.pdf","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/namcs2019sv.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Selected variables from the National Ambulatory Medical Care Survey (NAMCS) 2019 Public Use File (PUF) — namcs2019sv","text":"namcs2019sv_df data frame. namcs2019sv survey object created namcs2019sv_df using [survey::svydesign()].","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Print surveytable tables — print.surveytable_table","title":"Print surveytable tables — print.surveytable_table","text":"Print surveytable tables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print surveytable tables — print.surveytable_table","text":"","code":"# S3 method for surveytable_table print(x, ...) # S3 method for surveytable_list print(x, ...)"},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print surveytable tables — print.surveytable_table","text":"x object class surveytable_table surveytable_list. ... ignored","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print surveytable tables — print.surveytable_table","text":"x invisibly.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/print.surveytable_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print surveytable tables — print.surveytable_table","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> table1 = tab(\"AGER\") print(table1) #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> table_many = tab(\"MDDO\", \"SPECCAT\", \"MSA\") print(table_many) #> Type of doctor (MD or DO) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ M.D. - │ 7,498 │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ #> │ Doctor of │ │ │ │ │ │ │ │ │ │ #> │ Medicine │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ D.O. - │ 752 │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ #> │ Doctor of │ │ │ │ │ │ │ │ │ │ #> │ Osteopathy │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Primary │ 2,993 │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Surgical │ 3,050 │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Medical │ 2,207 │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Metropolitan Statistical Area Status of physician location {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ MSA │ 7,496 │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ #> │ (Metropolit │ │ │ │ │ │ │ │ │ │ #> │ an │ │ │ │ │ │ │ │ │ │ #> │ Statistical │ │ │ │ │ │ │ │ │ │ #> │ Area) │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ Non-MSA │ 754 │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding counts — set_count_1k","title":"Rounding counts — set_count_1k","text":"Determines counts rounded.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding counts — set_count_1k","text":"","code":"set_count_1k() set_count_int()"},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Rounding counts — set_count_1k","text":"(Nothing.)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Rounding counts — set_count_1k","text":"set_count_1k(): round counts nearest 1,000. set_count_int(): round counts nearest integer.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/set_count_1k.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Rounding counts — set_count_1k","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> set_count_int() #> * Rounding counts to the nearest integer. #> * ?set_count_int for other options. total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ #> │ n │ Number │ SE │ LL │ UL │ #> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 8,250 │ 1,036,484,356 │ 48,836,217 │ 945,013,590 │ 1,136,808,860 │ #> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> set_count_1k() #> * Rounding counts to the nearest 1,000. #> * ?set_count_1k for other options. total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ #> │ n │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ #> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 8,250 │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ #> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Set output defaults — set_output","title":"Set output defaults — set_output","text":"show_output() shows current defaults.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set output defaults — set_output","text":"","code":"set_output(drop_na = NULL, max_levels = NULL, csv = NULL) show_output()"},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set output defaults — set_output","text":"drop_na drop missing values (NA)? Categorical variables . max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file \"\" turn CSV output","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set output defaults — set_output","text":"(Nothing.)","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/set_output.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set output defaults — set_output","text":"","code":"tmp_file = tempfile(fileext = \".csv\") suppressMessages( set_output(csv = tmp_file) ) tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> set_output(csv = \"\") # Turn off CSV output #> * Turning off CSV output. #> * ?set_output for other options."},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Specify the survey to analyze — set_survey","title":"Specify the survey to analyze — set_survey","text":"need specify survey functions, tab(), work.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Specify the survey to analyze — set_survey","text":"","code":"set_survey(design, opts = \"NCHS\", csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Specify the survey to analyze — set_survey","text":"design either survey object (survey.design svyrep.design) data.frame unweighted survey. opts set certain options. See . csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Specify the survey to analyze — set_survey","text":"Info survey.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Specify the survey to analyze — set_survey","text":"opts: \"nchs\": Round counts nearest 1,000 -- see set_count_1k(). Identify low-precision estimates (surveytable.find_lpe option). Percentage CI's: adjust Korn-Graubard CI's number degrees freedom, matching SUDAAN calculation (surveytable.adjust_svyciprop option). \"general\": Round counts nearest integer -- see set_count_int(). look low-precision estimates (surveytable.find_lpe option). Percentage CI's: use standard Korn-Graubard CI's. Optionally, survey can attribute called label, long name survey. Optionally, variable survey can attribute called label, variable's long name.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/set_survey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Specify the survey to analyze — set_survey","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Show package options — show_options","title":"Show package options — show_options","text":"Show package options","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show package options — show_options","text":"","code":"show_options(sw = \"surveytable\")"},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show package options — show_options","text":"sw starting characters","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show package options — show_options","text":"List options values.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/show_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show package options — show_options","text":"","code":"show_options() #> $surveytable.adjust_svyciprop #> [1] TRUE #> #> $surveytable.adjust_svyciprop.df_method #> [1] \"NHIS\" #> #> $surveytable.csv #> [1] \"\" #> #> $surveytable.drop_na #> [1] FALSE #> #> $surveytable.find_lpe #> [1] TRUE #> #> $surveytable.max_levels #> [1] 20 #> #> $surveytable.names_count #> [1] \"n\" \"Number (000)\" \"SE (000)\" \"LL (000)\" \"UL (000)\" #> #> $surveytable.names_prct #> [1] \"Percent\" \"SE\" \"LL\" \"UL\" #> #> $surveytable.present_count #> [1] \".present_count\" #> #> $surveytable.present_prop #> [1] \".present_prop\" #> #> $surveytable.present_restricted #> [1] \".present_restricted\" #> #> $surveytable.rate_per #> [1] 100 #> #> $surveytable.survey_label #> [1] \"NAMCS 2019 PUF\" #> #> $surveytable.svychisq_statistic #> [1] \"F\" #> #> $surveytable.tx_count #> [1] \".tx_count_1k\" #> #> $surveytable.tx_prct #> [1] \".tx_prct\" #> #> $surveytable.tx_rate #> [1] \".tx_rate\" #>"},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-options.html","id":null,"dir":"Reference","previous_headings":"","what":"Package options — surveytable-options","title":"Package options — surveytable-options","text":"Run show_options() see available options.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-options.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Package options — surveytable-options","text":"Maintainer: Alex Strashny AStrashny@cdc.gov (ORCID)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-package.html","id":null,"dir":"Reference","previous_headings":"","what":"surveytable: Formatted Survey Estimates — surveytable-package","title":"surveytable: Formatted Survey Estimates — surveytable-package","text":"Short understandable commands generate tabulated, formatted, rounded survey estimates. Mostly wrapper 'survey' package (Lumley (2004) doi:10.18637/jss.v009.i08 https://CRAN.R-project.org/package=survey) identifies low-precision estimates using National Center Health Statistics (NCHS) presentation standards (Parker et al. (2017) https://www.cdc.gov/nchs/data/series/sr_02/sr02_175.pdf, Parker et al. (2023) doi:10.15620/cdc:124368 ).","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/surveytable-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"surveytable: Formatted Survey Estimates — surveytable-package","text":"Maintainer: Alex Strashny AStrashny@cdc.gov (ORCID)","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset a survey, while preserving variable labels — survey_subset","title":"Subset a survey, while preserving variable labels — survey_subset","text":"Subset survey, preserving variable labels","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset a survey, while preserving variable labels — survey_subset","text":"","code":"survey_subset(design, subset, label)"},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset a survey, while preserving variable labels — survey_subset","text":"design survey object subset expression specifying sub-population label survey label newly created survey object","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset a survey, while preserving variable labels — survey_subset","text":"new survey object","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/survey_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subset a survey, while preserving variable labels — survey_subset","text":"","code":"children = survey_subset(namcs2019sv, AGE < 18, \"Children < 18\") set_survey(children) #> Survey info {Children < 18} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 1,066 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (139) clusters. │ #> │ │ │ survey_subset(namcs2019sv, AGE < 18, \"Children │ #> │ │ │ < 18\") │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {Children < 18} #> ┌─────────────┬─────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼─────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 86.1 │ 1.6 │ 82.6 │ 89.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼─────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 179 │ 19,004 │ 2,872 │ 14,051 │ 25,702 │ 13.9 │ 1.6 │ 10.8 │ 17.4 │ #> └─────────────┴─────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 1066. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":null,"dir":"Reference","previous_headings":"","what":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"version survey::svyciprop() adjusts degrees freedom method = \"beta\".","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"","code":"svyciprop_adjusted( formula, design, method = c(\"logit\", \"likelihood\", \"asin\", \"beta\", \"mean\", \"xlogit\"), level = 0.95, df_method, ... )"},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"formula see survey::svyciprop(). design see survey::svyciprop(). method see survey::svyciprop(). level see survey::svyciprop(). df_method df calculated: \"default\" \"NHIS\". ... see survey::svyciprop().","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"point estimate proportion, confidence interval attribute.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"Written Makram Talih 2019. df_method: \"default\", df = degf(design); \"NHIS\", df = nrow(design) - 1. use function tabulations, call set_survey() opts = \"NCHS\" argument, type: options(surveytable.adjust_svyciprop = TRUE).","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/svyciprop_adjusted.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Confidence intervals for proportions, adjusted for degrees of freedom — svyciprop_adjusted","text":"","code":"set_survey(namcs2019sv, opts = \"NCHS\") #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate variables — tab","title":"Tabulate variables — tab","text":"Tabulate categorical (factor), logical, numeric variables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate variables — tab","text":"","code":"tab( ..., test = FALSE, alpha = 0.05, drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate variables — tab","text":"... names variables (quotes) test perform hypothesis tests? alpha significance level tests drop_na drop missing values (NA)? Categorical variables . max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate variables — tab","text":"list tables single table.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tabulate variables — tab","text":"categorical logical variables, presents estimated counts, standard errors (SEs) confidence intervals (CIs), percentages, SEs CIs. Checks presentation guidelines counts percentages flags estimates , according guidelines, suppressed, footnoted, reviewed analyst. numeric variables, presents percentage observations known values, mean known values, standard error mean (SEM), standard deviation (SD). CIs calculated 95% confidence level. CIs count estimates log Student's t CIs, adaptations complex surveys. CIs percentage estimates Korn Graubard CIs.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate variables — tab","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"AGER\") #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> tab(\"MDDO\", \"SPECCAT\", \"MSA\") #> Type of doctor (MD or DO) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ M.D. - │ 7,498 │ 980,280 │ 48,388 │ 889,842 │ 1,079,910 │ 94.6 │ 0.7 │ 93.1 │ 95.8 │ #> │ Doctor of │ │ │ │ │ │ │ │ │ │ #> │ Medicine │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ D.O. - │ 752 │ 56,204 │ 6,602 │ 44,597 │ 70,832 │ 5.4 │ 0.7 │ 4.2 │ 6.9 │ #> │ Doctor of │ │ │ │ │ │ │ │ │ │ #> │ Osteopathy │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Type of specialty (Primary, Medical, Surgical) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Primary │ 2,993 │ 521,466 │ 31,136 │ 463,840 │ 586,252 │ 50.3 │ 2.6 │ 45.1 │ 55.5 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Surgical │ 3,050 │ 214,832 │ 31,110 │ 161,661 │ 285,490 │ 20.7 │ 3   │ 15.1 │ 27.3 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Medical │ 2,207 │ 300,186 │ 43,497 │ 225,806 │ 399,067 │ 29   │ 3.6 │ 22.1 │ 36.6 │ #> │ care │ │ │ │ │ │ │ │ │ │ #> │ specialty │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Metropolitan Statistical Area Status of physician location {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ MSA │ 7,496 │ 973,676 │ 50,515 │ 879,490 │ 1,077,947 │ 93.9 │ 1.7 │ 89.7 │ 96.8 │ #> │ (Metropolit │ │ │ │ │ │ │ │ │ │ #> │ an │ │ │ │ │ │ │ │ │ │ #> │ Statistical │ │ │ │ │ │ │ │ │ │ #> │ Area) │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ Non-MSA │ 754 │ 62,809 │ 17,549 │ 36,249 │ 108,830 │ 6.1 │ 1.7 │ 3.2 │ 10.3 │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> # Numeric variables tab(\"NUMMED\") #> Number of medications coded {NAMCS 2019 PUF} #> ┌─────────┬──────┬───────┬──────┐ #> │ % known │ Mean │ SEM │ SD │ #> ├─────────┼──────┼───────┼──────┤ #> │ 100 │ 3.46 │ 0.268 │ 4.43 │ #> └─────────┴──────┴───────┴──────┘ #> # Hypothesis testing with categorical variables tab(\"AGER\", test = TRUE) #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Comparison of all possible pairs of Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ #> │ Level 1 │ Level 2 │ p-value │ Flag │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 15-24 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 25-44 years │ 0.012 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 75 years and over │ 0.022 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 25-44 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 65-74 years │ 0.065 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 75 years and over │ 0.878 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 65-74 years │ 75 years and over │ 0.019 │ * │ #> └────────────────┴───────────────────┴─────────┴──────┘ #> Design-based t-test. *: p-value <= 0.05 #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate rates — tab_rate","title":"Calculate rates — tab_rate","text":"Calculate rates categorical (factor) logical variables.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate rates — tab_rate","text":"","code":"tab_rate( vr, pop, per = getOption(\"surveytable.rate_per\"), drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate rates — tab_rate","text":"vr variable tabulate pop either single number data.frame columns named Level Population. Level must exactly match levels vr. Population population level vr. per calculate rate per many items population drop_na drop missing values (NA)? max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate rates — tab_rate","text":"list tables single table.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate rates — tab_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> # pop is a data frame tab_rate(\"MSA\", uspop2019$MSA) #> Metropolitan Statistical Area Status of physician location (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────────────┬───────┬───────┬──────┬───────┬───────┐ #> │ Level │ n │ Rate │ SE │ LL │ UL │ #> ├───────────────────────┼───────┼───────┼──────┼───────┼───────┤ #> │ MSA (Metropolitan │ 7,496 │ 351.2 │ 18.2 │ 317.2 │ 388.8 │ #> │ Statistical Area) │ │ │ │ │ │ #> ├───────────────────────┼───────┼───────┼──────┼───────┼───────┤ #> │ Non-MSA │ 754 │ 136.7 │ 38.2 │ 78.9 │ 236.8 │ #> └───────────────────────┴───────┴───────┴──────┴───────┴───────┘ #> N = 8250. Checked NCHS presentation #> standards. Nothing to report. #> # pop is a single number tab_rate(\"MDDO\", uspop2019$total) #> * Rate based on the entire population. #> Type of doctor (MD or DO) (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ #> │ Level │ n │ Rate │ SE │ LL │ UL │ #> ├───────────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ M.D. - Doctor of │ 7,498 │ 303.3 │ 15 │ 275.3 │ 334.1 │ #> │ Medicine │ │ │ │ │ │ #> ├───────────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ D.O. - Doctor of │ 752 │ 17.4 │ 2 │ 13.8 │ 21.9 │ #> │ Osteopathy │ │ │ │ │ │ #> └───────────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate subsets or interactions — tab_cross","title":"Tabulate subsets or interactions — tab_cross","text":"Create subsets survey using one variable, tabulate another variable within subsets. Interact two variables tabulate.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate subsets or interactions — tab_cross","text":"","code":"tab_cross( vr, vrby, max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") ) tab_subset( vr, vrby, lvls = c(), test = FALSE, alpha = 0.05, drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate subsets or interactions — tab_cross","text":"vr variable tabulate vrby use variable subset survey max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file lvls (optional) show levels vrby test perform hypothesis tests? alpha significance level tests drop_na drop missing values (NA)? Categorical variables .","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate subsets or interactions — tab_cross","text":"list tables single table.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tabulate subsets or interactions — tab_cross","text":"tab_subset creates subsets using levels vrby, tabulates vr subset. Optionally, use lvls levels vrby. vr can categorical (factor), logical, numeric. tab_cross crosses interacts vr vrby tabulates new variable. Tables created using tab_subset tab_cross counts different percentages. tab_subset, percentages within subset add 100%. tab_cross, percentages across entire population add 100%. Also see var_cross(). test = TRUE performs test association two variables. Also performs t-tests possible pairs levels vr vrby.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate subsets or interactions — tab_cross","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> # For each SEX, tabulate AGER tab_subset(\"AGER\", \"SEX\") #> Patient age recode (Patient sex = Female) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 9.9 │ 1.2 │ 7.6 │ 12.6 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 6.8 │ 0.7 │ 5.4 │ 8.4 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 18.8 │ 1.6 │ 15.8 │ 22.1 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 29.1 │ 1.7 │ 25.8 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 19.8 │ 1.5 │ 17   │ 22.9 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 15.6 │ 1.5 │ 12.8 │ 18.7 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 4609. Checked NCHS presentation standards. Nothing to report. #> #> Patient age recode (Patient sex = Male) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 13.4 │ 1.7 │ 10.3 │ 17.1 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 5.5 │ 0.8 │ 4   │ 7.3 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 13.1 │ 1.3 │ 10.7 │ 15.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 30.9 │ 1.6 │ 27.8 │ 34.3 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 20.1 │ 1.5 │ 17.3 │ 23.1 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 16.9 │ 1.5 │ 14   │ 20.2 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 3641. Checked NCHS presentation standards. Nothing to report. #> # Same counts as tab_subset(), but different percentages. tab_cross(\"AGER\", \"SEX\") #> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ #> │ and over: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ #> │ and over: │ │ │ │ │ │ │ │ │ │ #> │ Male │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> # Numeric variables tab_subset(\"NUMMED\", \"AGER\") #> Number of medications coded (for different levels of Patient age recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ Under 15 years │ 100 │ 1.58 │ 0.168 │ 1.75 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 15-24 years │ 100 │ 1.64 │ 0.112 │ 1.7  │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 25-44 years │ 100 │ 2.15 │ 0.225 │ 2.74 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 45-64 years │ 100 │ 3.49 │ 0.303 │ 4.49 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 65-74 years │ 100 │ 4.44 │ 0.431 │ 5.03 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 75 years and over │ 100 │ 5.53 │ 0.494 │ 5.59 │ #> └───────────────────┴─────────┴──────┴───────┴──────┘ #> # Hypothesis testing tab_subset(\"NUMMED\", \"AGER\", test = TRUE) #> Number of medications coded (for different levels of Patient age recode) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────┬──────┬───────┬──────┐ #> │ Level │ % known │ Mean │ SEM │ SD │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ Under 15 years │ 100 │ 1.58 │ 0.168 │ 1.75 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 15-24 years │ 100 │ 1.64 │ 0.112 │ 1.7  │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 25-44 years │ 100 │ 2.15 │ 0.225 │ 2.74 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 45-64 years │ 100 │ 3.49 │ 0.303 │ 4.49 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 65-74 years │ 100 │ 4.44 │ 0.431 │ 5.03 │ #> ├───────────────────┼─────────┼──────┼───────┼──────┤ #> │ 75 years and over │ 100 │ 5.53 │ 0.494 │ 5.59 │ #> └───────────────────┴─────────┴──────┴───────┴──────┘ #> #> Association between Number of medications coded and Patient age recode {NAMCS 2019 PUF} #> ┌─────────────────┬─────────────────┐ #> │ p-value │ Flag │ #> ├─────────────────┼─────────────────┤ #> │ 0 │ * │ #> └─────────────────┴─────────────────┘ #> Wald test. *: p-value <= 0.05 #> #> Comparison of Number of medications coded across all possible pairs of Patient age recode {NAMCS 2019 PUF} #> ┌────────────────┬───────────────────┬─────────┬──────┐ #> │ Level 1 │ Level 2 │ p-value │ Flag │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 15-24 years │ 0.739 │ │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 25-44 years │ 0.043 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ Under 15 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 25-44 years │ 0.029 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 15-24 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 45-64 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 65-74 years │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 25-44 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 65-74 years │ 0.007 │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 45-64 years │ 75 years and over │ 0     │ * │ #> ├────────────────┼───────────────────┼─────────┼──────┤ #> │ 65-74 years │ 75 years and over │ 0.002 │ * │ #> └────────────────┴───────────────────┴─────────┴──────┘ #> Design-based t-test. *: p-value <= 0.05 #>"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate rates for subsets — tab_subset_rate","title":"Calculate rates for subsets — tab_subset_rate","text":"Create subsets survey using one variable, tabulate rates another variable within subsets.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate rates for subsets — tab_subset_rate","text":"","code":"tab_subset_rate( vr, vrby, pop, lvls = c(), per = getOption(\"surveytable.rate_per\"), drop_na = getOption(\"surveytable.drop_na\"), max_levels = getOption(\"surveytable.max_levels\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate rates for subsets — tab_subset_rate","text":"vr variable tabulate vrby use variable subset survey pop data.frame columns named Level, Subset, Population. Level must exactly match levels vr. Subset must exactly match levels vrby. Population population level vr vrby. lvls (optional) show levels vrby per calculate rate per many items population drop_na drop missing values (NA)? max_levels categorical variable can many levels. Used avoid printing huge tables. csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate rates for subsets — tab_subset_rate","text":"list tables single table.","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/tab_subset_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate rates for subsets — tab_subset_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab_subset_rate(\"AGER\", \"SEX\", uspop2019$`AGER x SEX`) #> Patient age recode (Patient sex = Female) (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ #> │ Level │ n │ Rate │ SE │ LL │ UL │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ Under 15 years │ 434 │ 202.5 │ 24.3 │ 159.8 │ 256.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 15-24 years │ 346 │ 198.4 │ 21.9 │ 159.5 │ 246.8 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 25-44 years │ 923 │ 263.3 │ 26.5 │ 215.9 │ 321   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 45-64 years │ 1,253 │ 414   │ 37.7 │ 346.2 │ 495.1 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 65-74 years │ 891 │ 720.3 │ 66.4 │ 600.8 │ 863.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 75 years and over │ 762 │ 758.1 │ 89.2 │ 601.2 │ 956   │ #> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ #> N = 4609. Checked NCHS presentation standards. Nothing to report. #> #> Patient age recode (Patient sex = Male) (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ #> │ Level │ n │ Rate │ SE │ LL │ UL │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ Under 15 years │ 453 │ 187.4 │ 25   │ 144.1 │ 243.7 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 15-24 years │ 196 │ 113.1 │ 20.7 │ 78.4 │ 163   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 25-44 years │ 512 │ 133.4 │ 17.2 │ 103.4 │ 172   │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 45-64 years │ 1,030 │ 333.4 │ 32.3 │ 275.4 │ 403.5 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 65-74 years │ 770 │ 594.8 │ 46.4 │ 510.1 │ 693.6 │ #> ├───────────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ #> │ 75 years and over │ 680 │ 801.2 │ 73.2 │ 669.1 │ 959.5 │ #> └───────────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘ #> N = 3641. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":null,"dir":"Reference","previous_headings":"","what":"Total count — total","title":"Total count — total","text":"Total count","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Total count — total","text":"","code":"total(csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Total count — total","text":"csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Total count — total","text":"table","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Total count — total","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total() #> Total {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ #> │ n │ Number (000) │ SE (000) │ LL (000) │ UL (000) │ #> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 8,250 │ 1,036,484 │ 48,836 │ 945,014 │ 1,136,809 │ #> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":null,"dir":"Reference","previous_headings":"","what":"Overall rate — total_rate","title":"Overall rate — total_rate","text":"Overall rate","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Overall rate — total_rate","text":"","code":"total_rate( pop, per = getOption(\"surveytable.rate_per\"), csv = getOption(\"surveytable.csv\") )"},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Overall rate — total_rate","text":"pop population per calculate rate per many items population csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Overall rate — total_rate","text":"table","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/total_rate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Overall rate — total_rate","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> total_rate(uspop2019$total) #> Total (rate per 100 population) {NAMCS 2019 PUF} #> ┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐ #> │ n │ Rate │ SE │ LL │ UL │ #> ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ #> │ 8,250 │ 320.7 │ 15.1 │ 292.4 │ 351.7 │ #> └───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":null,"dir":"Reference","previous_headings":"","what":"US Population in 2019 — uspop2019","title":"US Population in 2019 — uspop2019","text":"Population estimates civilian non-institutional population United States July 1, 2019. Used calculating rates. usage examples, see *_rate functions.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US Population in 2019 — uspop2019","text":"","code":"uspop2019"},{"path":"https://cdcgov.github.io/surveytable/reference/uspop2019.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US Population in 2019 — uspop2019","text":"object class list length 7.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":null,"dir":"Reference","previous_headings":"","what":"Are all the variables true? (Logical AND) — var_all","title":"Are all the variables true? (Logical AND) — var_all","text":"Create new variable true variables list variables true.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Are all the variables true? (Logical AND) — var_all","text":"","code":"var_all(newvr, vrs)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Are all the variables true? (Logical AND) — var_all","text":"newvr name new variable created vrs vector logical variables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Are all the variables true? (Logical AND) — var_all","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_all.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Are all the variables true? (Logical AND) — var_all","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_all(\"Medicare and Medicaid\", c(\"PAYMCARE\", \"PAYMCAID\")) tab(\"Medicare and Medicaid\") #> Medicare and Medicaid {NAMCS 2019 PUF} #> ┌───────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 8,126 │ 1,016,202 │ 47,395 │ 927,389 │ 1,113,520 │ 98 │ 0.5 │ 96.9 │ 98.9 │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 124 │ 20,282 │ 5,177 │ 12,120 │ 33,941 │ 2 │ 0.5 │ 1.1 │ 3.1 │ #> └───────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to #> report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Is any variable true? (Logical OR) — var_any","title":"Is any variable true? (Logical OR) — var_any","text":"Create new variable true variables list variables true.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is any variable true? (Logical OR) — var_any","text":"","code":"var_any(newvr, vrs)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is any variable true? (Logical OR) — var_any","text":"newvr name new variable created vrs vector logical variables","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Is any variable true? (Logical OR) — var_any","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is any variable true? (Logical OR) — var_any","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_any(\"Imaging services\" , c(\"ANYIMAGE\", \"BONEDENS\", \"CATSCAN\", \"ECHOCARD\", \"OTHULTRA\" , \"MAMMO\", \"MRI\", \"XRAY\", \"OTHIMAGE\")) tab(\"Imaging services\") #> Imaging services {NAMCS 2019 PUF} #> ┌───────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 7,148 │ 901,115 │ 43,298 │ 820,085 │ 990,151 │ 86.9 │ 1.1 │ 84.6 │ 89.1 │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 1,102 │ 135,369 │ 13,574 │ 111,134 │ 164,890 │ 13.1 │ 1.1 │ 10.9 │ 15.4 │ #> └───────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to #> report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert factor to logical — var_case","title":"Convert factor to logical — var_case","text":"Convert factor logical","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert factor to logical — var_case","text":"","code":"var_case(newvr, vr, cases)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert factor to logical — var_case","text":"newvr name new logical variable created vr factor variable cases one levels vr converted TRUE. levels converted FALSE.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert factor to logical — var_case","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_case.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert factor to logical — var_case","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_case(\"Preventive care visits\", \"MAJOR\", \"Preventive care\") tab(\"Preventive care visits\") #> Preventive care visits {NAMCS 2019 PUF} #> ┌───────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 6,682 │ 812,861 │ 45,220 │ 728,841 │ 906,566 │ 78.4 │ 1.7 │ 74.9 │ 81.7 │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 1,568 │ 223,624 │ 18,520 │ 190,068 │ 263,103 │ 21.6 │ 1.7 │ 18.3 │ 25.1 │ #> └───────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to #> report. #> var_case(\"Surgery-related visits\" , \"MAJOR\" , c(\"Pre-surgery\", \"Post-surgery\")) tab(\"Surgery-related visits\") #> Surgery-related visits {NAMCS 2019 PUF} #> ┌───────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ FALSE │ 7,432 │ 969,451 │ 47,976 │ 879,793 │ 1,068,246 │ 93.5 │ 0.8 │ 91.9 │ 94.9 │ #> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤ #> │ TRUE │ 818 │ 67,034 │ 7,810 │ 53,273 │ 84,348 │ 6.5 │ 0.8 │ 5.1 │ 8.1 │ #> └───────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to #> report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse factor levels — var_collapse","title":"Collapse factor levels — var_collapse","text":"Collapse two levels factor variable single level.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse factor levels — var_collapse","text":"","code":"var_collapse(vr, newlevel, oldlevels)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse factor levels — var_collapse","text":"vr factor variable newlevel name new level oldlevels vector old levels","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse factor levels — var_collapse","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_collapse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse factor levels — var_collapse","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> tab(\"PRIMCARE\") #> Are you the patient's primary care provider? {NAMCS 2019 PUF} #> ┌─────────┬───────┬────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┬───────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ Flags │ #> │ │ │ (000) │ │ │ │ │ │ │ │ │ #> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Blank │ 16 │ 1,150 │ 478 │ 440 │ 3,005 │ 0.1 │ 0   │ 0   │ 0.2 │ Cx │ #> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Unknown │ 300 │ 39,519 │ 9,507 │ 24,520 │ 63,692 │ 3.8 │ 0.9 │ 2.3 │ 6   │ │ #> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ Yes │ 2,278 │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ │ #> ├─────────┼───────┼────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┼───────┤ #> │ No │ 5,656 │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ │ #> └─────────┴───────┴────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┴───────┘ #> N = 8250. Checked NCHS presentation standards: Cx: suppress count #> (and rate). #> var_collapse(\"PRIMCARE\", \"Unknown if PCP\", c(\"Blank\", \"Unknown\")) tab(\"PRIMCARE\") #> Are you the patient's primary care provider? {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Unknown if │ 316 │ 40,669 │ 9,479 │ 25,619 │ 64,560 │ 3.9 │ 0.9 │ 2.4 │ 6.1 │ #> │ PCP │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Yes │ 2,278 │ 383,481 │ 28,555 │ 331,362 │ 443,798 │ 37   │ 2.6 │ 31.9 │ 42.3 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ No │ 5,656 │ 612,335 │ 43,282 │ 533,050 │ 703,413 │ 59.1 │ 2.5 │ 53.9 │ 64.1 │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":null,"dir":"Reference","previous_headings":"","what":"Copy a variable — var_copy","title":"Copy a variable — var_copy","text":"Create new variable copy another variable. can modify copy, original remains unchanged. See examples.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Copy a variable — var_copy","text":"","code":"var_copy(newvr, vr)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Copy a variable — var_copy","text":"newvr name new variable created vr variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Copy a variable — var_copy","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_copy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Copy a variable — var_copy","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_copy(\"Age group\", \"AGER\") var_collapse(\"Age group\", \"65+\", c(\"65-74 years\", \"75 years and over\")) var_collapse(\"Age group\", \"25-64\", c(\"25-44 years\", \"45-64 years\")) tab(\"AGER\", \"Age group\") #> Patient age recode {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 years │ 1,435 │ 170,271 │ 13,966 │ 144,925 │ 200,049 │ 16.4 │ 1.1 │ 14.3 │ 18.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 years │ 2,283 │ 309,506 │ 23,290 │ 266,994 │ 358,787 │ 29.9 │ 1.4 │ 27.2 │ 32.6 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 years │ 1,661 │ 206,866 │ 14,366 │ 180,481 │ 237,109 │ 20   │ 1.2 │ 17.6 │ 22.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 1,442 │ 167,069 │ 15,179 │ 139,746 │ 199,735 │ 16.1 │ 1.3 │ 13.7 │ 18.8 │ #> │ and over │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #> #> Age group {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 887 │ 117,917 │ 14,097 │ 93,229 │ 149,142 │ 11.4 │ 1.3 │ 8.9 │ 14.2 │ #> │ years │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 years │ 542 │ 64,856 │ 7,018 │ 52,387 │ 80,292 │ 6.3 │ 0.6 │ 5.1 │ 7.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-64 │ 3,718 │ 479,777 │ 32,175 │ 420,624 │ 547,247 │ 46.3 │ 1.8 │ 42.7 │ 49.9 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65+ │ 3,103 │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross or interact two variables — var_cross","title":"Cross or interact two variables — var_cross","text":"Create new variable interaction two variables. Also see tab_cross().","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross or interact two variables — var_cross","text":"","code":"var_cross(newvr, vr, vrby)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross or interact two variables — var_cross","text":"newvr name new variable created vr first variable vrby second variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross or interact two variables — var_cross","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross or interact two variables — var_cross","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_cross(\"Age x Sex\", \"AGER\", \"SEX\") tab(\"Age x Sex\") #> (Patient age recode) x (Patient sex) {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 434 │ 59,958 │ 7,206 │ 47,318 │ 75,974 │ 5.8 │ 0.7 │ 4.5 │ 7.3 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 │ 346 │ 41,128 │ 4,532 │ 33,066 │ 51,156 │ 4   │ 0.4 │ 3.2 │ 4.9 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 │ 923 │ 113,708 │ 11,461 │ 93,256 │ 138,646 │ 11   │ 1   │ 9   │ 13.2 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 │ 1,253 │ 175,978 │ 16,009 │ 147,153 │ 210,450 │ 17   │ 1.1 │ 14.9 │ 19.3 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 │ 891 │ 120,099 │ 11,066 │ 100,171 │ 143,992 │ 11.6 │ 1   │ 9.7 │ 13.7 │ #> │ years: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 762 │ 94,173 │ 11,085 │ 74,682 │ 118,751 │ 9.1 │ 0.9 │ 7.3 │ 11.1 │ #> │ and over: │ │ │ │ │ │ │ │ │ │ #> │ Female │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 15 │ 453 │ 57,959 │ 7,728 │ 44,570 │ 75,371 │ 5.6 │ 0.7 │ 4.3 │ 7.2 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-24 │ 196 │ 23,728 │ 4,344 │ 16,457 │ 34,210 │ 2.3 │ 0.4 │ 1.6 │ 3.2 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 25-44 │ 512 │ 56,562 │ 7,277 │ 43,861 │ 72,942 │ 5.5 │ 0.6 │ 4.3 │ 6.8 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 45-64 │ 1,030 │ 133,528 │ 12,956 │ 110,319 │ 161,619 │ 12.9 │ 1   │ 10.9 │ 15.1 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65-74 │ 770 │ 86,766 │ 6,767 │ 74,409 │ 101,176 │ 8.4 │ 0.6 │ 7.2 │ 9.7 │ #> │ years: Male │ │ │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 75 years │ 680 │ 72,896 │ 6,661 │ 60,872 │ 87,296 │ 7   │ 0.6 │ 5.9 │ 8.3 │ #> │ and over: │ │ │ │ │ │ │ │ │ │ #> │ Male │ │ │ │ │ │ │ │ │ │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert numeric to factor — var_cut","title":"Convert numeric to factor — var_cut","text":"Create new categorical variable based numeric variable.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert numeric to factor — var_cut","text":"","code":"var_cut(newvr, vr, breaks, labels)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert numeric to factor — var_cut","text":"newvr name new factor variable created vr numeric variable breaks see cut() labels see cut()","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert numeric to factor — var_cut","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_cut.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert numeric to factor — var_cut","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_cut(\"Age group\" , \"AGE\" , c(-Inf, 0, 4, 14, 64, Inf) , c(\"Under 1\", \"1-4\", \"5-14\", \"15-64\", \"65 and over\")) tab(\"Age group\") #> Age group {NAMCS 2019 PUF} #> ┌─────────────┬───────┬─────────────┬──────────┬──────────┬──────────┬─────────┬─────┬──────┬──────┐ #> │ Level │ n │ Number │ SE (000) │ LL (000) │ UL (000) │ Percent │ SE │ LL │ UL │ #> │ │ │ (000) │ │ │ │ │ │ │ │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ Under 1 │ 203 │ 31,148 │ 5,282 │ 22,269 │ 43,566 │ 3   │ 0.5 │ 2.1 │ 4.1 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 1-4 │ 281 │ 38,240 │ 5,444 │ 28,864 │ 50,662 │ 3.7 │ 0.5 │ 2.7 │ 4.8 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 5-14 │ 403 │ 48,529 │ 5,741 │ 38,430 │ 61,282 │ 4.7 │ 0.5 │ 3.7 │ 5.9 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 15-64 │ 4,260 │ 544,632 │ 36,082 │ 478,254 │ 620,223 │ 52.5 │ 2   │ 48.6 │ 56.5 │ #> ├─────────────┼───────┼─────────────┼──────────┼──────────┼──────────┼─────────┼─────┼──────┼──────┤ #> │ 65 and over │ 3,103 │ 373,935 │ 24,523 │ 328,777 │ 425,296 │ 36.1 │ 1.9 │ 32.3 │ 40   │ #> └─────────────┴───────┴─────────────┴──────────┴──────────┴──────────┴─────────┴─────┴──────┴──────┘ #> N = 8250. Checked NCHS presentation standards. Nothing to report. #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":null,"dir":"Reference","previous_headings":"","what":"List variables in a survey. — var_list","title":"List variables in a survey. — var_list","text":"List variables survey.","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List variables in a survey. — var_list","text":"","code":"var_list(sw = \"\", all = FALSE, csv = getOption(\"surveytable.csv\"))"},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List variables in a survey. — var_list","text":"sw starting characters variable name (case insensitive) print variables? csv name CSV file","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List variables in a survey. — var_list","text":"table","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List variables in a survey. — var_list","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_list(\"age\") #> Variables beginning with 'age' {NAMCS 2019 PUF} #> ┌──────────┬─────────┬──────────────────────┐ #> │ Variable │ Class │ Long name │ #> ├──────────┼─────────┼──────────────────────┤ #> │ AGE │ numeric │ Patient age in years │ #> ├──────────┼─────────┼──────────────────────┤ #> │ AGER │ factor │ Patient age recode │ #> └──────────┴─────────┴──────────────────────┘ #>"},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":null,"dir":"Reference","previous_headings":"","what":"Logical NOT — var_not","title":"Logical NOT — var_not","text":"Logical ","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Logical NOT — var_not","text":"","code":"var_not(newvr, vr)"},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Logical NOT — var_not","text":"newvr name new variable created vr logical variable","code":""},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Logical NOT — var_not","text":"Survey object","code":""},{"path":[]},{"path":"https://cdcgov.github.io/surveytable/reference/var_not.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Logical NOT — var_not","text":"","code":"set_survey(namcs2019sv) #> Survey info {NAMCS 2019 PUF} #> ┌───────────┬──────────────┬────────────────────────────────────────────────┐ #> │ Variables │ Observations │ Design │ #> ├───────────┼──────────────┼────────────────────────────────────────────────┤ #> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │ #> │ │ │ (with replacement) │ #> │ │ │ With (398) clusters. │ #> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │ #> │ │ │ ~CSTRATM, weights = ~PATWT, │ #> │ │ │ data = namcs2019sv_df) │ #> └───────────┴──────────────┴────────────────────────────────────────────────┘ #> var_not(\"Private insurance not used\", \"PAYPRIV\")"},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-development-version","dir":"Changelog","previous_headings":"","what":"surveytable (development version)","title":"surveytable (development version)","text":"codebook() Improved output. Allows unweighted survey data.frame. Can set certain options using argument.","code":""},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-092","dir":"Changelog","previous_headings":"","what":"surveytable 0.9.2","title":"surveytable 0.9.2","text":"CRAN release: 2024-01-18 Addressed CRAN comments.","code":""},{"path":"https://cdcgov.github.io/surveytable/news/index.html","id":"surveytable-091","dir":"Changelog","previous_headings":"","what":"surveytable 0.9.1","title":"surveytable 0.9.1","text":"Initial CRAN submission.","code":""}] diff --git a/man/set_survey.Rd b/man/set_survey.Rd index 9e6ecc9..6bdbb75 100644 --- a/man/set_survey.Rd +++ b/man/set_survey.Rd @@ -27,13 +27,13 @@ will work. \item \code{"nchs"}: \itemize{ \item Round counts to the nearest 1,000 -- see \code{\link[=set_count_1k]{set_count_1k()}}. -\item Identify low-precision estimates (\code{surveytable.check_present} option). +\item Identify low-precision estimates (\code{surveytable.find_lpe} option). \item Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation (\code{surveytable.adjust_svyciprop} option). } \item \verb{"general":} \itemize{ \item Round counts to the nearest integer -- see \code{\link[=set_count_int]{set_count_int()}}. -\item Do not look for low-precision estimates (\code{surveytable.check_present} option). +\item Do not look for low-precision estimates (\code{surveytable.find_lpe} option). \item Percentage CI's: use standard Korn-Graubard CI's. } } diff --git a/vignettes/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.Rmd b/vignettes/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.Rmd index eefabc8..cb7df90 100644 --- a/vignettes/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.Rmd +++ b/vignettes/Example-National-Ambulatory-Medical-Care-Survey-NAMCS-tables.Rmd @@ -232,7 +232,7 @@ suppressMessages( set_output(csv = tmp_file) ) for (vr in c("AGER", "Age group", "SEX", "Age x Sex")) { var_cross("tmp", "MAJOR", vr) for (lvl in levels(surveytable:::env$survey$variables[,vr])) { - tab_subset("SPECCAT", "tmp", paste0("Preventive care : ", lvl)) + tab_subset("SPECCAT", "tmp", paste0("Preventive care: ", lvl)) } } set_output(csv = "") @@ -243,7 +243,7 @@ set_output(csv = "") * As before, the loop goes through the age, sex, and age / sex interaction variables, calling each of these variables `vr`. * MAJOR and `vr` are crossed, with the result stored in a variable called `tmp`. * Next, the inner loop goes through all levels of `vr`, calling each of these levels `lvl`. -* The code tabulates `SPECCAT` (Type of specialty – Primary, Medical, Surgical) on a subset in which `tmp` (which is `MAJOR` crossed with `vr`) is restricted to “Preventive care:” followed by `lvl`, which is some level of `vr`, such as “Under 15 years” for `AGER`. +* The code tabulates `SPECCAT` (Type of specialty – Primary, Medical, Surgical) on a subset in which `tmp` (which is `MAJOR` crossed with `vr`) is restricted to `"Preventive care: "` followed by `lvl`, which is some level of `vr`, such as “Under 15 years” for `AGER`. * Finally, CSV output is turned off. If you run this code, all of the tables should be stored in the CSV file. To give you an idea of what the tables should look like, here is just one of the tables: @@ -252,7 +252,7 @@ If you run this code, all of the tables should be stored in the CSV file. To giv vr = "AGER" var_cross("tmp", "MAJOR", vr) lvl = levels(surveytable:::env$survey$variables[,vr])[1] -tab_subset("SPECCAT", "tmp", paste0("Preventive care : ", lvl)) +tab_subset("SPECCAT", "tmp", paste0("Preventive care: ", lvl)) ``` To match the percentage in the published table, see the "Primary care specialty" row. Be sure to check the presentation standards flags.