This function scans a standard query output for weeks where collaboration hours is far outside the mean. Returns a list of weeks that appear to be holiday weeks and optionally an edited dataframe with outliers removed. By default, missing values are excluded.

As best practice, run this function prior to any analysis to remove atypical collaboration weeks from your dataset.

identify_holidayweeks(data, sd = 1, return = "message")

Arguments

data

A Standard Person Query dataset in the form of a data frame.

sd

The standard deviation below the mean for collaboration hours that should define an outlier week. Enter a positive number. Default is 1 standard deviation.

return

String specifying what to return. This must be one of the following strings:

  • "message" (default)

  • "data"

  • "data_cleaned"

  • "data_dirty"

  • "plot"

See Value for more information.

Value

A different output is returned depending on the value passed to the return

argument:

  • "message": message on console. a message is printed identifying holiday weeks.

  • "data": data frame. A dataset with outlier weeks flagged in a new column is returned as a dataframe.

  • "data_cleaned": data frame. A dataset with outlier weeks removed is returned.

  • "data_dirty": data frame. A dataset with only outlier weeks is returned.

  • "plot": ggplot object. A line plot of Collaboration Hours with holiday weeks highlighted.

Metrics used

The metric Collaboration_hours is used in the calculations. Please ensure that your query contains a metric with the exact same name.

Examples

# Return a message by default
identify_holidayweeks(sq_data)
#> The weeks where collaboration was 1 standard deviations below the mean (19.9) are: 
#> `2019-12-01`

# Return plot
identify_holidayweeks(sq_data, return = "plot")