R/binary.flip.r

Defines functions binary.flip

Documented in binary.flip

# flip binary variable

#' binary.flip
#'
#' Flip binary numbers
#'
#' @export binary.flip
#' @author Jared P. Lander
#' @aliases binary.flip
#' @param x A vector of 0/1 numbers.
#' @return X with 0's flipped to 1's and 1's flipped to 0's
#' @examples
#'
#' binary.flip(c(1,1,0,1,0,0,1))
#'
binary.flip <- function(x)
{
    x*-1 + 1
}

Try the useful package in your browser

Any scripts or data that you put into this service are public.

useful documentation built on June 10, 2018, 1:04 a.m.