Skip to contents

Returns a named numeric vector of point estimates from a survey_result object (produced by get_means(), get_totals(), get_freqs(), get_ratios(), get_quantiles(), get_corr(), get_covariance(), or get_diffs()).

Usage

# S3 method for class 'survey_result'
coef(object, ...)

Arguments

object

A survey_result object from any supported get_*() function.

...

Unused. Reserved for future extensions.

Value

A named numeric vector. Names follow variable-major, group-secondary ordering matching survey::coef.svyby(). For grouped results, names are "group_value:variable_name" (e.g., "A:y1", "B:y1"). For ungrouped results, names are the variable name (e.g., "y1"). See the spec for class-specific naming rules.

Details

Not all survey_result subclasses support coef(). survey_t_test and survey_pairwise objects throw surveycore_error_result_method_unsupported. Wide-format survey_corr objects (from get_corr(format = "wide")) also throw this error. For those objects, access columns directly (e.g., result$estimate, result$se).

Examples

d <- as_survey(
  nhanes_2017,
  ids = sdmvpsu,
  weights = wtint2yr,
  strata = sdmvstra,
  nest = TRUE
)
result <- get_means(d, ridageyr, variance = "se")
coef(result)
#> ridageyr 
#> 38.42397