| To: | <s-news@lists.biostat.wustl.edu> |
|---|---|
| Subject: | Filling a vector at some places |
| From: | <Andre.Mery@aventis.com> |
| Date: | Wed, 29 Sep 2004 13:33:37 +0200 |
| Thread-index: | AcSmGCk0NXdVxCVzS1mynUdFXNwKtQ== |
| Thread-topic: | Filling a vector at some places |
|
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 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | COURSE: S-PLUS Essentials November 2004, Karen Richardson |
|---|---|
| Next by Date: | Iteratively reweighted least squares, mtexeira |
| Previous by Thread: | COURSE: S-PLUS Essentials November 2004, Karen Richardson |
| Next by Thread: | Re: Filling a vector at some places, Liaw, Andy |
| Indexes: | [Date] [Thread] [Top] [All Lists] |