This function identifies and counts the number of employees who have churned
from the dataset by measuring whether an employee who is present in the first
n
(n1) weeks of the data is present in the last n
(n2) weeks of the data.
identify_churn(data, n1 = 6, n2 = 6, return = "message", flip = FALSE)
A Person Query as a data frame. Must contain a PersonId
.
A numeric value specifying the number of weeks at the beginning of the period that defines the measured employee set. Defaults to 6.
A numeric value specifying the number of weeks at the end of the period to calculate whether employees have churned from the data. Defaults to 6.
String specifying what to return. This must be one of the following strings:
"message"
(default)
"text"
"data"
See Value
for more information.
Logical, defaults to FALSE. This determines whether to reverse
the logic of identifying the non-overlapping set. If set to TRUE
, this
effectively identifies new-joiners, or those who were not present in the
first n weeks of the data but were present in the final n weeks.
A different output is returned depending on the value passed to the return
argument:
"message"
: Message on console. A diagnostic message.
"text"
: String. A diagnostic message.
"data"
: Character vector containing the the PersonId
of
employees who have been identified as churned.
An additional use case of this function is the ability to identify
"new-joiners" by using the argument flip
.
If an employee is present in the first n
weeks of the data but not present
in the last n
weeks of the data, the function considers the employee as
churned. As the measurement period is defined by the number of weeks from the
start and the end of the passed data frame, you may consider filtering the
dates accordingly before running this function.
Another assumption that is in place is that any employee whose PersonId
is
not available in the data has churned. Note that there may be other reasons
why an employee's PersonId
may not be present, e.g. maternity/paternity
leave, Viva Insights license has been removed, shift to a
low-collaboration role (to the extent that he/she becomes inactive).
Other Data Validation:
check_query()
,
extract_hr()
,
flag_ch_ratio()
,
flag_em_ratio()
,
flag_extreme()
,
flag_outlooktime()
,
hr_trend()
,
hrvar_count_all()
,
hrvar_count()
,
hrvar_trend()
,
identify_holidayweeks()
,
identify_inactiveweeks()
,
identify_nkw()
,
identify_outlier()
,
identify_privacythreshold()
,
identify_query()
,
identify_shifts_wp()
,
identify_shifts()
,
identify_tenure()
,
remove_outliers()
,
standardise_pq()
,
subject_validate_report()
,
subject_validate()
,
track_HR_change()
,
validation_report()
sq_data %>% identify_churn(n1 = 3, n2 = 3, return = "message")
#> Churn:
#> There are 0 employees from 2019-11-03 to 2019-11-17 (3 weeks) who are no longer present in 2020-01-12 to 2020-01-26 (3 weeks).