Learn R Programming

verdata (version 1.0.2)

proportions_imputed: Calculate the proportions of each level of a variable after applying combine_replicates to completed data (includes imputed values).

Description

Calculate the proportions of each level of a variable after applying combine_replicates to completed data (includes imputed values).

Usage

proportions_imputed(complete_data, strata_vars, digits = 2)

Value

A data frame that contains the proportions after applying combine_replicates.

Arguments

complete_data

A data frame containing the output from combine_replicates.

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 value is 2.

Examples

Run this code
local_dir <- system.file("extdata", "right", package = "verdata")
replicates_data <- read_replicates(replicates_dir = local_dir,
violation = "reclutamiento", replicate_nums = c(1, 2), version = "v1",
crash = TRUE)
replicates_obs_data <- summary_observed("reclutamiento", replicates_data,
strata_vars = "sexo", conflict_filter = FALSE, forced_dis_filter = FALSE,
edad_minors_filter = FALSE, include_props = FALSE)
tab_combine <- combine_replicates("reclutamiento", replicates_obs_data,
replicates_data, strata_vars = 'sexo', conflict_filter = TRUE,
forced_dis_filter = FALSE, edad_minors_filter = FALSE, include_props = FALSE)
prop_data_complete <- proportions_imputed(tab_combine, strata_vars = "sexo",
digits = 2)

Run the code above in your browser using DataLab