Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LISSY - R code for example plots
library(readr)
library(dplyr)
library(magrittr)
library(purrr)
library(ggplot2)
all_lissyrtools_scripts <- fs::dir_ls("/media/user/lissyrtools/")
invisible(purrr::map(all_lissyrtools_scripts, ~ source(.x)))
# Script --------------------------
## Read files
lissy_datasets <- read_lissy_files(files = c("ca17h", "de16h", "ee13h",
"fi16h", "fr10h", "it16h"),
full_year_name = TRUE)
## Data management
lissy_datasets %<>%
transform_negative_values_to_zero(variable = "dhi") %>%
transform_equivalise(variable = "dhi") %>%
transform_top_code_with_iqr(variable = "dhi", times = 3) %>%
transform_weight_by_hh_size(variable = "dhi")
## Compute estimates
lissy_datasets %>%
print_indicator(variable = "dhi", indicator = "gini", na.rm = TRUE)
## Plot Lorenz Curve
lissy_datasets %>%
plot_lorenz_curve(variable = "dhi", na.rm = TRUE, plot_theme = "lis")
## Plot Median
## IMPORTANT: BOTH PLOTS CAN NOT BE PRODUCED IN THE SAME LISSY JOB!
lissy_datasets %>%
transform_adjust_by_lisppp(variable = "dhi") %>%
plot_indicator(variable = "dhi", indicator = "median", na.rm = TRUE, plot_theme = "lis")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment