Skip to content

creating a pixel image

1 message · Sarah Goslee

#
Hi,

It's good form to reply to the list rather than just to me, and I've
taking the liberty of doing so.

So is, "How can I use im() from spatstat with data of this format to
make a pixel image that I can use as a covariate for my analysis?" a
good summary of your question? Complete information up front means
that people don't have to spend time asking for more information.

Yes, im() can be used to make a pixel image from a matrix. You don't
have a matrix, but instead a vector of points with x and y
coordinates. It's normally easy to turn that into a matrix, but your
points do not fall on a regular grid in the coordinate system being
used, so I think you'd have to interpolate in some way to create such
a matrix, which is an entirely different problem.

Unless I'm missing something, you need to process your data before you
can make a pixel image from it. The r-sig-geo mailing list might be of
more use for that.

You can see this by plotting
with(mydata, plot(X, Y))
to see where the values are.

For the rest of the list, K?tia sent me her full dataset offlist. I'm
reluctant to include it here, but the point pattern it produces is on
a regular grid, but rotated with respect to the coordinate system
being used so that there are irregular distances between X and Y
values. If it were my data, I'd use GIS software to interpolate it to
a regular grid, though there are several ways of varying complexity to
do that in R.

Sarah
On Mon, Jul 9, 2012 at 1:40 PM, K?tia Emidio <kat.emidio at gmail.com> wrote: