Hi
I have 3 vectors, say g1, g2 and f, where g1 and g2 contain the row and column indices of a matrix, with corresponding elements in f. How can I create a matrix containing the values in f ?
For example:
g1  g2  f
3   4  10
2   1  30
4   4  50
How can then get a matrix that looks as follows:
 0   0   0   0
30  0   0   0
 0   0   0   10
 0   0   0   50
 
I am still learning R. I think reshape will help, but it is not clear how that works here.
 
Any help is much appreciated.
Thank you.
Jacob
 
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

	[[alternative HTML version deleted]]

