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% (4403) of the person-date rows in the data have extreme Outlook settings.
#> 0% (0)  have an Outlook workday shorter than 5 hours, while 100% (4403) have a workday longer than 13 hours.

# Return data
flag_outlooktime(spq_df, threshold = c(5, 13), return = "data")
#> # A tibble: 4,403 × 5
#>    PersonId                   WorkdayRange WorkdayFlag WorkdayFlag1 WorkdayFlag2
#>    <chr>                             <dbl> <lgl>       <lgl>        <lgl>       
#>  1 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  2 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  3 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  4 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  5 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  6 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  7 93F763956FFC939A5DDE7D599…           17 TRUE        FALSE        TRUE        
#>  8 0451CB55483735A680919F760…           17 TRUE        FALSE        TRUE        
#>  9 0451CB55483735A680919F760…           17 TRUE        FALSE        TRUE        
#> 10 0451CB55483735A680919F760…           17 TRUE        FALSE        TRUE        
#> # ℹ 4,393 more rows