Try this
> set.seed(42)
> Vec1 <- sample(0:1, 15, replace=TRUE)
> Vec2 <- sample(0:1, 15, replace=TRUE)
> Vec3 <- sample(0:1, 15, replace=TRUE)
> paste0(ifelse(Vec1,"A",""),
ifelse(Vec2,"B",""),

ifelse(Vec3,"C",""))
[1] "ABC" "ABC" "" "AC"
"AB" "ABC" "A" "B" "ABC"
"AC" "B"
"A"
[13] "AB" "C" "B"
-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Arnaud Michel
Sent: Tuesday, June 18, 2013 11:58 AM
To: r-help at r-project.org
Subject: [R] transform 3 numeric vectors empty of 0/1
Dear all,
Without a loop, I would like transform 3 numeric vectors empty of
0/1 of
same length
Vec1 : transform 1 to A and 0 to ""
Vec2 : transform 1 to B and 0 to ""
Vec3 : transform 1 to C and 0 to ""
to obtain only 1 vector Vec who is the paste of the 3 vectors (Ex :
ABC,
BC, AC, AB,...)
Any idea ?
Thank you for your help
--
Michel ARNAUD
______________________________________________
R-help at 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.