recodeBinary {dinamic}R Documentation

Recode binary vectors

Description

Recode binary vectors

Usage

recodeBinary(binary.vec, k)

Arguments

binary.vec

A binary vector of length m (>= 1) whose kth entry is 1.

k

A positive integer.

Details

This function is called internally by peeling.

Value

A binary vector of length m that contains a single contiguous string of 1's, namely the string that contains the 1 in the kth position of binary.vec.

Examples

test = c(1, 0, 0, 1, 1, 0, 0, 1, 0)
recodeBinary(test, 5)   
#Returns (0, 0, 0, 1, 1, 0, 0, 0, 0)


[Package dinamic version 1.0.1 Index]