#' Transforming BCSI_ID to N_PERS
#'
#' @details rstats version of the excel calculation =(A32*100)+ (97-((A32-INT(A32/97)*97)))
#'
#' @param bcsi A BCSI_ID to transform to N_PERS
#'
#' @return A character string with 10 digit N_PERS
#' @import stringr
#' @export
#'
#' @examples
#' bcsi_to_npers(00392498)
#' bcsi_to_npers(392498)
bcsi_to_npers <- function(bcsi) {
if(anyNA(as.numeric(bcsi))) {
warning("bcsi contains non-numeric characters")
}
bcsi <- as.numeric(bcsi)
npers <- (bcsi*100) + (97-(bcsi - (bcsi %/% 97)*97))
npers <- stringr::str_pad(npers, side = "left", width = 10, pad = "0")
return(npers)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.