View source: R/identify_habit.R
identify_habit | R Documentation |
Based on the principle of consistency, this function identifies whether a habit exists over a given interval of time. A habit is defined as a behaviour (action taken) that is repeated at least x number of times consistently over n weeks.
identify_habit(
data,
metric,
threshold = 1,
width,
max_window,
hrvar = NULL,
return = "plot",
plot_mode = "time"
)
data |
Data frame containing Person Query to be analysed. The data frame
must have a |
metric |
Character string specifying the metric to be analysed. |
threshold |
Numeric value specifying the minimum number of times the metric sum up to in order to be a valid count. A 'greater than or equal to' logic is used. |
width |
Integer specifying the number of qualifying counts to consider for a habit. The function assumes a weekly interval is used. |
max_window |
Integer specifying the maximum unit of dates to consider a
qualifying window for a habit. If your data is grouped at a weekly level,
then |
hrvar |
Character string specifying the HR attribute or organisational
variable to group by. Default is |
return |
Character string specifying the type of output to be returned. Valid options include:
|
plot_mode |
Character string specifying the type of plot to be returned.
Only applicable when
|
Each week is considered as a binary variable on whether sufficient action has
been taken for that given week (a qualifying count). Sufficiency is
determined by the threshold
parameter. For instance, if the threshold is
set to 2, this means that there must be 2 qualifying actions (e.g. summarise
meeting in Copilot) in a week for there to be a qualifying count for the
week.
One way of determining the parameters would be to consider, how many counts
of width
should occur within a max_window
period for it to be considered
a habit?
# Return a plot
identify_habit(
pq_data,
metric = "Multitasking_hours",
threshold = 1,
width = 9,
max_window = 12,
return = "plot"
)
# Return a summary
identify_habit(
pq_data,
metric = "Multitasking_hours",
threshold = 1,
width = 9,
max_window = 12,
return = "summary"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.