Learn R Programming

verdata (version 1.0.2)

proportions_observed: Calculate the proportions of each level of a variable after applying summary_observed to observed values.

Description

Calculate the proportions of each level of a variable after applying summary_observed to observed values.

Usage

proportions_observed(obs_data, strata_vars, digits = 2)

Value

A data frame that contains the proportions after applying summary_observed.

Arguments

obs_data

A data frame containing the output from summary_observed.

strata_vars

A vector of column names identifying the variables to be used for stratification.

digits

Number of decimal places to round the results to. Default is 2.

Examples

Run this code
# \donttest{
local_dir <- system.file("extdata", "right", package = "verdata")
replicates_data <- read_replicates(local_dir, "reclutamiento", c(1, 2), version = "v1")
tab_observed <- summary_observed("reclutamiento", replicates_data,
strata_vars = "sexo", conflict_filter = TRUE, forced_dis_filter = FALSE,
edad_minors_filter = TRUE, include_props = TRUE)
prop_data <- proportions_observed(tab_observed, strata_vars = "sexo",
digits = 2)
# }

Run the code above in your browser using DataLab