#' A round function that prroximates the way SPSS calculates round
#' (always rounds 0.5*n up)
#'
#' @return A vector of rounded values
#'
#' @param x The vector to round
#' @param n digit number before floating point
#'
#' @examples
#' spss_round(c(0.50,0.49,1.5),0)
#' round(c(0.50,0.49,1.5),0)
#' @export
spss_round = function(x, n=0) {
posneg = sign(x)
z = abs(x)*10^n
z = z + 0.5
z = trunc(z)
z = z/10^n
z*posneg
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.