#' Calculate Rate of Unpaid Leave
#'
#' Calculates the cost of one days unpaid leave.
#' For more information see
#' \url{https://stackoverflow.com/c/poissonconsulting/questions/63}
#'
#' @param annual_salary An number of the annual salary
#' @param days_paid_leave An number of the number of days paid leave per year.
#' @export
#' @examples
#' pts_rate_unpaid_leave(35000, 20)
pts_rate_unpaid_leave <- function(annual_salary, days_paid_leave) {
checkor(check_vector(annual_salary, c(1e+04L, 1e+05L, NA)),
check_vector(annual_salary), c(1e+04, 1e+05, NA))
checkor(check_vector(days_paid_leave, c(0L, 40L, NA), length = length(annual_salary)),
check_vector(days_paid_leave, c(0, 40, NA), length = length(annual_salary)))
if(!length(annual_salary)) return(double(0))
paid_days <- 5 * 52 - days_paid_leave
rate <- annual_salary / paid_days
rate
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.