[R] Dataset Transformation

Santosh Srinivas santosh.srinivas at gmail.com
Mon Oct 11 15:35:21 CEST 2010


Repost .. since the previous msg had problems

I need to transpose the following input dataset  into an output dataset like
below

Input
Date		TICKER		Price
11/10/2010		A		0.991642
11/10/2010		B		0.475023
11/10/2010		C		0.218642
11/10/2010		D		0.365135
12/10/2010		A		0.687873
12/10/2010		B		0.47006
12/10/2010		C		0.533542
12/10/2010		D		0.812439
13/10/2010		A		0.210848
13/10/2010		B		0.699799
13/10/2010		C		0.546003
13/10/2010		D		0.152316

Output needed 

Date	A	B	C	D
11/10/2010	0.991642	0.475023	0.218642	0.365135
12/10/2010	0.687873	0.47006	0.533542	0.812439
13/10/2010	0.210848	0.699799	0.546003	0.152316

I tried using the aggregate function but not quite getting the method.



More information about the R-help mailing list