View source: R/compute_functions.R
compute_percentiles | R Documentation |
experimental Compute the weighted percentages for a LIS or LWS variable.
compute_percentiles(
file,
file_name,
variable,
breaks = seq(0, 1, 0.1),
weight = NULL,
na.rm = FALSE
)
file |
A LIS or LWS file. |
file_name |
The name of the LIS or LWS file. |
variable |
A character vector of length one with the indicator that needs to be transformed. |
breaks |
A numeric vector specifying the percentiles that should be computed. Defaults to all deciles. |
weight |
A string with the name of the variable in 'file' that should be used as sample weights. |
na.rm |
A boolean indicating if the computation should ignore missing values in 'variable' and 'weight'. |
It uses 'pwgt' or 'hwgt' to weight the indicator.
A data.frame with two columns: 'percentile' and 'value'. The first contains the label of the percentiles computed (e.g. '0.5' for median, '0.2' for first quintile). The second contains the values of these in the distribution of 'variable'.
## Not run:
lissy_datasets <- read_lissy_files(c("fr84h", "fr94h", "fr10h"))
compute_percentiles(lissy_datasets[["fr1984h"]], variable = "dhi", na.rm = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.