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

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 `dv_data`
flag_outlooktime(dv_data)
#> [Warning]  94.9% (832) of the person-date rows in the data have extreme Outlook settings.
#> 0% (0)  have an Outlook workday shorter than 4 hours, while 94.9% (832) have a workday longer than 15 hours.

# Example where Outlook Start and End times are imputed
spq_df <- sq_data

spq_df$WorkingStartTimeSetInOutlook <- "6:30"

spq_df$WorkingEndTimeSetInOutlook <- "23:30"

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

# Return data
flag_outlooktime(spq_df, threshold = c(5, 13), return = "data")
#> # A tibble: 13,442 × 5
#>    PersonId                                      Workd…¹ Workd…² Workd…³ Workd…⁴
#>    <chr>                                           <dbl> <lgl>   <lgl>   <lgl>  
#>  1 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  2 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  3 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  4 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  5 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  6 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  7 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  8 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#>  9 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#> 10 93F763956FFC939A5DDE7D599D04923290B41C935ECA…      17 TRUE    FALSE   TRUE   
#> # … with 13,432 more rows, and abbreviated variable names ¹​WorkdayRange,
#> #   ²​WorkdayFlag, ³​WorkdayFlag1, ⁴​WorkdayFlag2