[R] x,y,z table to matrix with x as rows and y as columns

jiho jo.irisson at gmail.com
Tue Jul 24 19:23:33 CEST 2007


Hello all,

I am sure I am missing something obvious but I cannot find the  
function I am looking for. I have a data frame with three columns: X,  
Y and Z, with X and Y being grid coordinates and Z the value  
associated with these coordinates. I want to transform this data  
frame in a matrix of Z values, on the grid defined by X and Y (and,  
as a plus, fill the X.Y combinations which do no exist in the  
original data frame with NAs in the resulting matrix). I could do  
this manually but I guess the appropriate function should be  
somewhere around. I just can't find it.

Thank you in advance for your help.

JiHO
---
http://jo.irisson.free.fr/



More information about the R-help mailing list