contrib <- c(-1, 0, 0, 1)
contrib0 <- c(FALSE, FALSE, TRUE, FALSE)
contribCodes <- recode2(contrib>0, contrib0,
c('returned', 'received', '0', 'ERR') )
cC <- c('returned', 'returned', '0', 'received')
stopifnot(
all.equal(contribCodes, cC)
)
Run the code above in your browser using DataLab