#' Check if numbers are even
#'
#' @export
#' @param x numerical object of integer value
#' @examples
#' is.even(2)
#' is.even(5)
#' is.even(-4)
#' is.even(0)
#'
#' # use vectors
#' is.even( c(5,3,-2,0,4) )
#'
is.even <- function(x=NULL) {
if(!all(is.wholenumber(x))) stop("x is not of integer value")
x %% 2 == 0
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.