s-news
[Top] [All Lists]

replace?

To: "s-news" <s-news@lists.biostat.wustl.edu>
Subject: replace?
From: "Heymans, MW" <mw.heymans@vumc.nl>
Date: Mon, 17 Jul 2006 09:51:45 +0200
Thread-index: AcapdGnO11sHsbNyR5qOHj6PaH+bGQ==
Thread-topic: replace?
Hi all,
 
Some help is appreciated with this one.
I have a matrix k with 2 columns: the first 10 rows are:
     [,1]      [,2]
 [1,]    4 0.9952229
 [2,]    5 0.9936306
 [3,]    6 0.9856688
 [4,]    7 0.9824841
 [5,]    9 0.9808917
 [6,]   10 0.9729299
 [7,]   11 0.9713376
 [8,]   12 0.9697452
 [9,]   13 0.9649682
[10,]   14 0.9538217

I also have a vector x with the following 15 components:

[1] 4 10 7 12 7 10 11 11 12 7 4 7 12 11 10

Now I want to replace the vector components with the values of

the 2nd column of matrix k, related to the values in the 1st column of this matrix, like this:

[1] 0.9952229 0.9729299 0.9824841 0.9697452 0.9824841 etc.

Thanks in advance,

Martijn

 


<Prev in Thread] Current Thread [Next in Thread>