Dear r-help contributors,

I have two questions:

first:

I have a matrix A and a vector B.
I want to make a new matrix C, which is made of the rows of A having a value
included in B.

Second:

I have two matrixes A and B, of different dimensions.
B has unique values in column 2 and A has not unique values on column 2.
I want to merge this two matrixes by the values in the columns 2 of B and 2
of A in such a way that the resulting matrix will be C:


A:

1 2
2 2
3 3
4 3
5 4
6 4
7 5
8 5


B:

1 2  x c d
2 3  y f  g

C:

1 2  x c d
2 2  x c d
3 3  y f  g
4 3  y f  g
5 4 NA NA
6 4 NA NA
7 5 NA NA
8 5 NA NA


Can you help me?


Many thanks in advance.

	[[alternative HTML version deleted]]


