})))
# user system elapsed
# 1.256 0.000 1.257
system.time({
dat2<-colwise(recode)(dat1,recodes="1='ABC';0=''")
res3<-Reduce(paste0,lapply(seq_len(ncol(dat2)),function(i)
substr(dat2[,i],i,i)))
})
# user system elapsed
# 2.232 0.008 2.249
id L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Arnaud Michel
Sent: Tuesday, June 18, 2013 11:58 AM
To: r-help@r-project.org
Subject:
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,...)
An
3 matches
Mail list logo