On Fri, 30 Jan 2009, Miguel Eduardo Gil Biraud wrote:

Hi,

I was going to post a similar question as I am also a fresh new user of R.


This isn't the same question, so the threads are crossed now ...

In my case I have between 10 million and 20 million latitude,
longitude pairs and want to get an image in which each pixel has a
color that is a function of the amount of positions that would fall
into the spatial bin corresponding to the pixel size. I understand
that this would be akin to a 2D histogram of my data and resemble a
density plot.

The way I started doing that was importing the table with read.table()
and then converting it to a PPP object providing the adequate bounds.
The first problem I face is that when I try to put all the points into
the PPP object I get a memory failure.

To keep experimenting I lowered the number of points I import and
played around with the density function available in spatstat but
while I can see its uses when you have few points, in my case the
patters would get diluded very fast even for small values of sigma and
I am afraid it would not represent the data faithfully.

On the other hand the function quadratcount returns very fast results
for a high number of partitions in the X and Y axis and I could
certainly use the results it provides, if it wouldn't be for the fact
that when I try to plot it, I get the grid and the point count inside
each cell. Is there any way to convert the output of gridcount into a
colored plot in the same spirit of the one you get when you do a
plot(density())?

Hope it wasn't too confusing. As you can see I've tried to take a jab
at it on my own, but it is proving more complicated than I expected!
:)

If you simplify, you'll see that all you are trying to do is count points in grid cells. While a quadrat count looks natural, that function is actually used to show why quadrat counts as a method of point pattern analysis are inadequate. My guess is that you should look at the overlay() method for SpatialPoints and SpatialGrid objects in the sp package, which will return a vector showing which grid cell each point belongs to. From there, you can use other functions, for example table(), to tally, then construct a SpatialGridDataFrame.

At your choice, GE_SpatialGrid() in maptools and image() will let you display your output in Google Earth if you choose, image() or spplot() for regular R graphics, or write it out and read into a GIS or paint program with writeGDAL() in rgdal.

Roger



Cheers,
Miguel

On Fri, Jan 30, 2009 at 06:09, srinivasa raghavan
<srinivasrag...@gmail.com> wrote:
Hi r-sig-geo team,

I am a new user of R 2.8.1 in windows 2003. I have a data set of football
ball pattern data. The data is for multiple matches. The variables are :

match: The code number of the match.
period: First half or second half denotted by 1 or 2.
pitchX:  The x co-ordinate of the field.
pitchy: The y-co-ordinate of the field.
seconds: The time point.

I am interested to draw the football graph/diagram and then plot the above
data.

Can any one let me know the right functions/packages which can help me in
this regard.

thanks in advance.

warm regards,
srinivas
statistical analyst.

       [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo






--
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.biv...@nhh.no

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to