|
vec1[vec2] <- 1 ought to do it, or is that not what you
want?
HTH,
Andy
Hi,
I am stuck by the
following problem.
I have a
vector with 36 positions, all set to 0:
vec1 = 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
Now, after some
other calculations, I get a the vector:
vec2
= 18 1 5 2
And so, I want to
transform the vec1 to a vec3:
vec3 =
1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
where 1s appear at
the places indicated by vec2 (places # 1, 2, 5 and 18)
I can't find a
simple way to do so. Can anyone enlighten me ?
André
Méry Aventis
Pharma 20,
avenue Raymond Aron - 92160 Antony [Courrier
/ Mail : Tri B2/13]
[Tél.
/ Tel. : 01 55 71 68 69]
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.
------------------------------------------------------------------------------
|