3 differ2()
The differ2()
function codes differences between two vectors as a 1; otherwise, 0. This function is based on Stata’s egen differ()
command. 2
## x y z
## [1,] 1 1 0
## [2,] 2 6 1
## [3,] 3 3 0
## [4,] 4 8 1
## [5,] 5 5 0