Learn R Programming

Logib

Introduction

The package logib is an R implementation of the Swiss Confederation's salary analysis tool for assessing equal pay practices (https://www.logib.admin.ch)

Installation

GitHub

In order to install the package from GitHub, use the devtools package:

install.packages("devtools")
devtools::install_github("admin-ebg/logib")

CRAN

In order to install the latest release from CRAN, use:

install.packages("logib")

Examples

library(logib)

# ------------------------------------------------------------------------------
# Variant 1: Using an official datalist or exportfile

# Indicate path to the pre-filled datalist or exportfile 
# (see 'Further Resources' below)
path_to_my_data <- "path/to/my/datalist_or_exportfile.xlsx"
# Read the data from an official datalist to R
my_data <- read_data(data_path = path_to_my_data)

# ------------------------------------------------------------------------------
# Variant 2: Using a pre-loaded dataframe called 'my_dataframe'

# Read the data from the pre-loaded dataframe
my_data <- read_data(custom_data = my_dataframe)

# ------------------------------------------------------------------------------
# Variant 3: Using the included example datalist called 'datalist_example'

datalist_example

# ==============================================================================
# Run the analysis and store the results
results <- analysis(data = datalist_example, 
   reference_month = 1, reference_year = 2019, usual_weekly_hours = 40, 
   female_spec = "F", male_spec = "M", age_spec = "age")
# Display the results of the analysis
summary(results)

Further Resources

Copy Link

Version

Install

install.packages('logib')

Monthly Downloads

200

Version

0.2.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Marc Stöckli

Last Published

December 20th, 2024

Functions in logib (0.2.0)

prepare_data

Prepares a dataframe for the analysis
read_data

Create the dataframe object used for the standard analysis model
download_datalist

Download official Excel datalists
compute_age

Compute age values
build_custom_mapping

Build column name mappings
transform_data

Transform a data.frame according to the requirements of the model
summary.analysis_model

Summary of the Salary Analysis
download_example_datalist

Download official filled-in sample Excel datalists
analysis

Run a Salary Analysis
feb29_between

Check if the interval between two dates contains February 29
all_column_names

Column names
compute_years_of_service

Compute years_of_service value
within_a_year

Check if the interval between two dates is less than a year
run_standard_analysis_model

Standard Analysis Model
datalist_example

Example datalist
check_data

Check a dataframe
read_official_excel

Read official datalist or data_export Excel file
yearfrac

Time difference between two dates in fractional year terms
build_errors

Builds a dataframe of errors
get_kennedy_estimator

Kennedy Estimator