Hi all,

I have a matrix which looks like the following,

x=matrix(c(1,2,3,4,3,5,4,6,4,9),5,2,byrow=T)

Now, I want to replace the 2nd columns of those 4 rows which have duplicate
entries in the 1st column. For example, x[2,1]=x[3,1]=3 and I want to
replace x[3,2] by x[2,2]. Similarly, I want to replace x[5,2] with x[4,2],
which means that for duplicate entries in the 1st column, I want to replace
the corresponding entries in the 2nd column with its 1st entry of the
duplicate row.

Can anybody help me in this regard?

Thanks,
Cassie

	[[alternative HTML version deleted]]

