Title: | Salary Analysis by the Swiss Federal Office for Gender Equality |
---|---|
Description: | Implementation of the Swiss Confederation's standard analysis model for salary analyses <https://www.ebg.admin.ch/en/equal-pay-analysis-with-logib> in R. The analysis is run at company-level and the model is intended for medium-sized and large companies. It can technically be used with 50 or more employees (apprentices, trainees/interns and expats are not included in the analysis). Employees with at least 100 employees are required by the Gender Equality Act to conduct an equal pay analysis. This package allows users to run the equal salary analysis in R, providing additional transparency with respect to the methodology and simple automation possibilities. |
Authors: | Marc Stöckli [aut, cre], Jonathan Chassot [aut], Jeremy Kolly [ctb], Federal Office for Gender Equality of Switzerland [cph, fnd] |
Maintainer: | Marc Stöckli <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.0 |
Built: | 2025-02-19 06:31:36 UTC |
Source: | CRAN |
List of column names used in the code, from the datalist and exportfiles in all four languages (de, fr, it, en)
all_column_names
all_column_names
An object of class list
of length 3.
Runs a salary analysis according to the Swiss standard analysis model
analysis( data, reference_month, reference_year, usual_weekly_hours = NULL, female_spec = "F", male_spec = "M", age_spec = NULL, entry_date_spec = NULL )
analysis( data, reference_month, reference_year, usual_weekly_hours = NULL, female_spec = "F", male_spec = "M", age_spec = NULL, entry_date_spec = NULL )
data |
a data.frame of employees as produced by |
reference_month |
an integer representing the reference month, i.e. the month for which we analyze the salaries |
reference_year |
an integer representing the reference year, i.e. the year for which we analyze the salaries |
usual_weekly_hours |
an optional numeric representing the usual weekly
working hours (missing values in |
female_spec |
an optional string or numeric representing the way women
are encoded in the |
male_spec |
an optional string or numeric representing the way men are
encoded in the |
age_spec |
an optional string to specify the way |
entry_date_spec |
an optional string to specify the way
|
object of type analysis_model
with the following
elements
params: |
The set of original parameters passed to the function |
data_original: |
The original data passed by the user in the
|
data_clean: |
The cleaned up data which was used for the analysis |
data_errors: |
The list of errors which were found upon checking the data |
results: |
The result of the standard analysis model |
results <- analysis(data = datalist_example, reference_month = 1, reference_year = 2019, usual_weekly_hours = 40, female_spec = "F", male_spec = "M", age_spec = "age")
results <- analysis(data = datalist_example, reference_month = 1, reference_year = 2019, usual_weekly_hours = 40, female_spec = "F", male_spec = "M", age_spec = "age")
build_custom_mapping
creates a vector of column name mappings for the
user to read her or his custom dataframe
build_custom_mapping(data, language = "de", prompt_mapping = TRUE)
build_custom_mapping(data, language = "de", prompt_mapping = TRUE)
data |
the custom dataframe for which the user wants to build a custom mapping |
language |
a character string representing the language in which the
columns will be displayed during the mapping prompt ( |
prompt_mapping |
a boolean indicating whether the function prompts the user for the exact mapping of his dataframe or whether the columns are mapped automatically by order |
Builds a mapping from the custom column names of a given data.frame to the
variable names used in the standard analysis model. If prompt_mapping
is set to TRUE
, the function prompts the mapping for each column
of the data.frame. If prompt_mapping
is set to FALSE
, the
mapping is built using the order of the columns of the given data.frame.
A named vector of characters, where the name indicates the column name in the original data.frame and the value indicates the column name as used by the standard analysis model.
Fictional dataset containing the necessary information to run an equal pay analysis.
datalist_example
datalist_example
A data frame with 318 rows and 23 variables:
personal number of the employee, alphanumeric
,
age, in years
,
sex, 1 = male, 2 = female
,
years of service, in years
,
training code, 1-8
,
function / job
,
level of requirements code, 1-4
,
professional position / hierarchy code, 1-5
,
activity rate, in percent
,
paid hours, in hours
,
basic wage, in CHF
,
allowances, in CHF
,
13th monthly wage, in CHF
,
special payments, in CHF
,
weekly contractual hours, in hours
,
annual contractual hours, in hours
,
analysis population code, 1-5
,
comments for the employee
,
additional remarks (1 of 5)
,
additional remarks (2 of 5)
,
additional remarks (3 of 5)
,
additional remarks (4 of 5)
,
additional remarks (5 of 5)
Downloads an empty version of the latest official Excel datalist in the
specified language to the given path
.
download_datalist(file, language = "de")
download_datalist(file, language = "de")
file |
a character string representing the file path to which the downloaded datalist will be saved. |
language |
a character string representing the language of the datalist
to be download ( |
None
Downloads a filled-in version of the latest official Excel datalist in the
specified language to the given path
.
download_example_datalist(file, language = "de")
download_example_datalist(file, language = "de")
file |
a character string representing the file path to which the downloaded datalist will be saved. |
language |
a character string representing the language of the datalist
to be download ( |
None
Reads either a custom dataframe object or an official Excel file (datalist or data export) and transforms it to a dataframe object which can be used for the standard analysis model
read_data( data_path = NULL, custom_data = NULL, prompt_mapping = TRUE, language = "de" )
read_data( data_path = NULL, custom_data = NULL, prompt_mapping = TRUE, language = "de" )
data_path |
a string indicating the path for an official Excel file,
if this parameter is set to |
custom_data |
a dataframe which was imported by the user beforehand,
if this parameter is set to |
prompt_mapping |
a boolean indicating whether the function prompts the
user for the exact mapping of his dataframe or whether the columns are
mapped automatically by order. This parameter is only relevant when
|
language |
a character string representing the language in which the
columns will be displayed during the mapping prompt ( |
Exactly one of data_path
or custom_data
must be NULL
.
a dataframe which can be used to compute the standard analysis model
Summary of an estimated salary analysis object of class
analysis_model
## S3 method for class 'analysis_model' summary(object, ...)
## S3 method for class 'analysis_model' summary(object, ...)
object |
estimated salary analysis object of class
|
... |
further arguments passed to or from other methods |
summary.analysis_model
provides a short summary of the wage
analysis according to the Standard Analysis Model. The summary describes the
number of records used for the analysis, the Kennedy estimate of the wage
difference under otherwise equal circumstances and the summary of the linear
regression.
Nothing
# Estimate standard analysis model results <- analysis(data = datalist_example, reference_month = 1, reference_year = 2019, usual_weekly_hours = 40, female_spec = "F", male_spec = "M", age_spec = "age") # Show summary of the salary analysis summary(results)
# Estimate standard analysis model results <- analysis(data = datalist_example, reference_month = 1, reference_year = 2019, usual_weekly_hours = 40, female_spec = "F", male_spec = "M", age_spec = "age") # Show summary of the salary analysis summary(results)
Transforms specific columns of a data.frame to match the requirements of the standard analysis model.
transform_data( data, reference_year, usual_weekly_hours, female_spec = "F", male_spec = "M", age_spec = NULL, entry_date_spec = NULL )
transform_data( data, reference_year, usual_weekly_hours, female_spec = "F", male_spec = "M", age_spec = NULL, entry_date_spec = NULL )
data |
a dataframe object as produced by |
reference_year |
a number indicating the reference year of the analysis |
usual_weekly_hours |
an optional numeric representing the usual weekly working hours |
female_spec |
a string or number indicating the way females are specified in the dataset. |
male_spec |
a string or number indicating the way males are specified in the dataset |
age_spec |
a string indicating the age specification, can be one of
|
entry_date_spec |
a string indicating the entry_date specification, can
be one of |