If the goal is to produce a filled contour plot, then look at the levelplot 
function in the trellis package, it takes the data in the form that you already 
have it, no need to transform.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of jonathan
> Sent: Tuesday, December 14, 2010 3:14 PM
> To: r-help@r-project.org
> Subject: Re: [R] from table to matrix
> 
> 
> That's so weird, I just signed up on here to ask exactly the same
> question!
> 
> However, I think my issue is like Jessica's who says that her data is
> like
> that, not actually that...
> 
> So the issue is not in generating that data on-the-fly but in
> transforming
> it from a data frame to a matrix.
> 
> As a more concrete example, I have read the following data in from a
> file
> (around 300,000 rows):
> 
> x    y     z
> 0    0    687
> 0    1    64
> 0    2    71
> 0    3    55
> 0    4    52
> 0    5    51
> 0    6    38
> 0    7    38
> 0    8    54
> 0    9    49
> .........
> .........
> .........
> 304979    282977    1
> 351377    1547980    1
> 383835    1740541    1
> 418133    6024710    1
> 421549    1028572    1
> 471314    1751836    1
> 579602    1817393    1
> 713515    5524385    1
> 
> 
> So what I want to do is transform this into a matrix where at position
> (x,y)
> in the matrix I have value z. I am doing this so that I can then do a
> filled.contour plot on the data.
> 
> I think this is the same as what Jessica is asking...
> 
> Regards and many thanks,
> 
> Jonathan
> UCL Computer Science
> --
> View this message in context: http://r.789695.n4.nabble.com/from-table-
> to-matrix-tp3087972p3088096.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to