Last active
September 15, 2023 08:55
-
-
Save JosepER/d891ef2ae8e13a03b1d5c1101c4b7846 to your computer and use it in GitHub Desktop.
lissyrtools example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(lissyrtools) | |
library(magrittr) | |
files_h <- read_lissy_files(c("ca14h", "ca15h", "ca16h", "ca17h", "ca18h", "ca19h"), | |
col_select = "dhi") | |
files_p <- read_lissy_files(c("ca14p", "ca15p", "ca16p", "ca17p", "ca18p", "ca19p"), | |
col_select = c("pi11", "age")) | |
lissy_datasets <- merge_dataset_levels(files_h, files_p) | |
# pi11 | |
lissy_datasets_transformed <- lissy_datasets %>% | |
transform_false_zeros_to_na("pi11") %>% | |
transform_negative_values_to_zero("pi11") %>% | |
transform_zeros_to_na("pi11") %>% | |
transform_top_code_with_iqr("pi11") %>% | |
transform_bottom_code_with_iqr("pi11") %>% | |
transform_adjust_by_lisppp("pi11") %>% | |
transform_restrict_age("pi11", from = 16, to = 64) | |
# dhi | |
lissy_datasets_transformed <- lissy_datasets_transformed %>% | |
transform_false_zeros_to_na("dhi") %>% | |
transform_negative_values_to_zero("dhi") %>% | |
transform_top_code_with_iqr("dhi") %>% | |
transform_bottom_code_with_iqr("dhi") %>% | |
transform_equivalise("dhi") %>% | |
transform_adjust_by_lisppp("dhi") | |
print_indicator(lissy_datasets_transformed, | |
variable = "dhi", | |
indicator = "gini", | |
na.rm = TRUE) | |
print_indicator(lissy_datasets_transformed, | |
variable = "pi11", | |
indicator = "gini", | |
na.rm = TRUE) | |
plot_indicator(lissy_datasets_transformed, variable = "dhi", | |
indicator = "gini", | |
na.rm = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment