Skip to contents

This function flags unusual outlook calendar settings for start and end time of work day.

Usage

flag_outlooktime(data, threshold = c(4, 15), return = "message")

Arguments

data

A data frame containing a Person Query.

threshold

A numeric vector of length two, specifying the hour threshold for flagging. Defaults to c(4, 15).

return

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

  • "text" (default)

  • "message"

  • "data"

Value

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

argument:

  • "text": string. A diagnostic message.

  • "message": message on console. A diagnostic message.

  • "data": data frame. Data where flag is present.

See Value for more information.

Examples

# Demo with `pq_data` example where Outlook Start and End times are imputed
spq_df <- pq_data

spq_df$WorkingStartTimeSetInOutlook <- "6:30"

spq_df$WorkingEndTimeSetInOutlook <- "23:30"

# Return a message
flag_outlooktime(spq_df, threshold = c(5, 13))
#> [Warning]  100% (1000) of the person-date rows in the data have extreme Outlook settings.
#> 0% (0)  have an Outlook workday shorter than 5 hours, while 100% (1000) have a workday longer than 13 hours.

# Return data
flag_outlooktime(spq_df, threshold = c(5, 13), return = "data")
#> # A tibble: 1,000 × 5
#>    PersonId                   WorkdayRange WorkdayFlag WorkdayFlag1 WorkdayFlag2
#>    <chr>                             <dbl> <lgl>       <lgl>        <lgl>       
#>  1 a6afe34c-8524-32d3-a368-1…           17 TRUE        FALSE        TRUE        
#>  2 d6368140-9312-380b-bbc9-9…           17 TRUE        FALSE        TRUE        
#>  3 60bf99b0-65fd-3c3f-94fb-8…           17 TRUE        FALSE        TRUE        
#>  4 93fddd74-3667-392b-ba5a-9…           17 TRUE        FALSE        TRUE        
#>  5 53183116-2cb2-32ee-9042-d…           17 TRUE        FALSE        TRUE        
#>  6 0a83c097-8796-3b8b-b15f-e…           17 TRUE        FALSE        TRUE        
#>  7 17ac6cbf-1b86-3c01-a7c1-3…           17 TRUE        FALSE        TRUE        
#>  8 48cfb0e6-05da-31c9-b0a0-c…           17 TRUE        FALSE        TRUE        
#>  9 1f907ab1-f3de-3472-acef-a…           17 TRUE        FALSE        TRUE        
#> 10 5538a778-326b-3efe-92f1-8…           17 TRUE        FALSE        TRUE        
#> # ℹ 990 more rows