Hello, All, I have a dataset that looks like this: x <- matrix(c( 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1), ncol = 5, byrow = T, dimnames = list(1:10, c("gender", "race", "disease")))
I want to write a function to produce several matrices including only “TRUE” and “FALSE” for the different levels of the variables (these matrices may be thought as index matrices), like > m1 TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > m2 FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE > m3 FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE > m4 FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE Can anyone please help how to get this done? Your help would be greatly appreciated. Lisa -- View this message in context: http://n4.nabble.com/dataset-index-tp948049p948049.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.