Skip to content
Prev 244765 / 398502 Next

Data permutation

Hello R User,

I am new in R and trying to migrate from SAS. I have to convert a table that
look like this

YEAR	FIRM		ID_NAME		VALUE
1994	Microsoft	John Doe		5
1994	Microsoft	Mark Smith		3
1994	Microsoft	David Ring		2

In this: 
YEAR	FIRM		ID1		vALUE	ID2		VALUE
1994	Microsoft	John Doe	5		Mark Smith		3
1994	Microsoft	John Doe	5		David Ring		2
1994	Microsoft	Mark Smith	3		David Ring		2

I have to do it for all the possible pair combination of ID_Name linked to
the same firm for any given year in my sample. 
Do you have any suggestion?

Thank you very much,

Matteo