Will this do it: > x <- sample(0:1,10,TRUE) > x [1] 1 0 0 1 0 1 0 0 0 0 > ifelse(x == 1, "P", "A") [1] "P" "A" "A" "P" "A" "P" "A" "A" "A" "A" >
On Mon, Aug 17, 2009 at 10:22 AM, Lana Schaffer<[email protected]> wrote: > Hi, > Can someone suggest an efficient way to substitute a vector/matrix > which contains 1's and 0's to P's and A's (resp.)? > Thanks, > Lana > ______________________________________________ > [email protected] 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ [email protected] 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.

