[R] Advice on Grid Data
Lorenzo Isella
lorenzo.isella at gmail.com
Fri Nov 24 14:38:01 CET 2006
On 24/11/06, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Fri, 24 Nov 2006, Lorenzo Isella wrote:
>
> > Dear All,
> > I would like to automate the analysis and plotting of data taken from a grid.
> > Typically I deal with 2 spatial coordinates and a scalar f(x,y), but
> > the spatial grid is not evenly spaced at all and usually given in this
> > form:
> > x y f(x,y)
> > 0.0 0.048979383 2.7659438106975056
> > 0.0 0.044986665 2.603891585041688
> > 0.0023807306 0.04787451 2.715949356768243
> > 0.0 0.040993948 2.469223979694342
> > 0.0023807306 0.043881793 2.5625191444824265
> > 0.004761461 0.046769638 2.6629703119429022
> > 0.0 0.03700123 2.361940994655468
> > 0.0023807306 0.039889075 2.436480700580665
> > 0.004761461 0.04277692 2.517958884562618
> > 0.0071421918 0.045664765 2.606844303834078
> > 0.0 0.060880877 3.470808435449538
> > 0.0 0.05691371 3.1907723461238686
> > 0.0020467786 0.059650626 3.3672237912200016
> > 0.0 0.05294655 2.9558174712065237
> > 0.0020467786 0.055683464 3.1075221272152054
> > 0.004093557 0.05842038 3.268965886866726
> > 0.0020467786 0.051716298 2.8929170062920653
> > 0.004093557 0.054453213 3.029154848759894
> > 0.006140336 0.057190128 3.1754081073235088
> > 0.0 0.02473231 2.138648866573983
> > 0.0 0.020556964 2.092324627395541
> >
> > I tried the image plot and lattice but unsuccessfully. Now I am
> > reading about the sp package (
> > http://cran.r-project.org/src/contrib/Descriptions/sp.html ), but I
> > mainly would like a piece of advice about what tools to use and how to
> > read and plot these data (I suppose it must be common e.g. in
> > geography to deal with this kind of problems).
>
> Your data are not on a 2D grid, there are (here) 7 unique x values, but 21
> unique y values of 21. You can treat the data as a SpatialPointsDataFrame
> (see note in R News in 2005), but if you want to display them on an actual
> grid, you will have to interpolate. For more ideas, perhaps try the
> R-sig-geo mailing list.
>
> > Kind Regards
> >
> > Lorenzo
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> --
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
>
>
Thanks for the advice, but I hope I have not been misleading: only
part of the grid coordinates are reported here (the whole list is very
long).
Does your conclusion hold anyway?
Cheers
Lorenzo
More information about the R-help
mailing list