getProportionSingleVariable: Get a Single Variable "Yes" Proportion

Description Usage Arguments Details Value Note See Also Examples

View source: R/getProportionSingleVariable.R

Description

Retrieves the proportion and confidence interval for a single variable in the YRBSS binary version, for a given location and a given year, as well as additional filters

Usage

1
2
getProportionSingleVariable(.variable = NULL, .location = NULL,
  .year = NULL, .filters = NULL, .level = 0.95)

Arguments

.variable

a string representing the name of the desired binary variable

.location

a string representing the desired location, defaults to "US"

.year

a int of the desired year (currently: 1991 to 2015)

.filters

a vector of strings representing desired filters (see details)

.level

the desired confidence interval level, defaults to 0.95

Details

This function is a wrapper of the survey package svyciprop function to adequately return a proportion for a single binary variable with confidence interval, from the YRBSS survey which contains complex weighted sampling. You should NOT report proportions based on the raw data in yrbss_data_binary or yrbss_states_data_binary.

Value

a list containing:

prop

the proportion of "Yes" for the desired variables within given filters

ciLB

Confidence Interval lower bound

ciUB

Confidence Interval upper bound

n

Sample size

Note

This function does basic input validity check-ups, e.g. if the .year parameter entered makes sense or if the .location is valid. It does NOT however checks if for a given .variable, for a given .year and possibly more filters there is enough (or at all) data to report a proportion. If that isn't the case you should get a list of NAs + a Warning.

See Also

yrbss_data_binary, yrbss_states_data_binary, getListOfParticipatingStates, yrbss_questions_binary

Examples

1
getProportionSingleVariable("qn8", "US", 2015)

gsimchoni/yrbss documentation built on May 24, 2019, 4:05 a.m.