How to use source code for .NET to transform PDF page to high quality jpg file You can use nested ifelse() statements to recode dummies, though there might be an even more R-tastic way: resp <- cbind(c(0,0,0,1,1,0,1,0,0,0,0), c(1,0,0,0,0,0,0,1,0,0,1), c(0,1,0,0,0,0, .