Learn R Programming

inTextSummaryTable (version 3.3.2)

convertVectToBinary: Convert vector to a bincode of 0/1 based on consecutive values in the vector.

Description

Convert vector to a bincode of 0/1 based on consecutive values in the vector.

Usage

convertVectToBinary(x)

Value

Integer vector of same length than x.

Arguments

x

Vector.

Author

Laure Cougnaud

Examples

Run this code
x <- c("group1", "group1", "group1", "group2", "group2", "group3", "group4", "group4")
convertVectToBinary(x = x)

Run the code above in your browser using DataLab