Skip to content

creating a pixel image

3 messages · Kátia Emidio, Sarah Goslee, JOSE MANUEL BLANCO MORENO

#
Hi,
Someone could help me in create a pixel image using  the SPATSTAT Package?
Attached there is a sample from my data. The column names are (x and y
coordinates, and elevation (alt_m).
Thanks
#
Hi,

I'm not quite clear on what you want; see below.
On Sun, Jul 8, 2012 at 6:37 PM, K?tia Emidio <kat.emidio at gmail.com> wrote:
spatstat doesn't deal with pixel images (raster?) but instead with
point pattern objects. If that's what you want, ?ppp will get you
started.
You don't provide either enough data or enough information for me to
be able to know whether your data are gridded or not. If so, this will
work for creating a SpatialGridDataFrame:

library(sp)
coordinates(mydata) <- ~X+Y

But I'm not sure if that's what you want: what are you trying to do,
and what do your data represent?

Sarah
#
Is it for using it as a covariate in ppm? You have function:

 im(mat, xcol=seq_len(ncol(mat)), yrow=seq_len(nrow(mat)),
   xrange=NULL, yrange=NULL,
   unitname=NULL)

Which will create it. I have used it at some point, trying to import raster objects a bit brute force, and I had to play around with transposing and reordering of rows and/or columns. Your data is not a matrix, so you will need to create a matrix containing your data in an appropriate way. However, your data seem to be a transect (line) so not really fitting to create an image...


---------------------------------------
Jos? M. Blanco-Moreno
Dept. de Biologia Vegetal (Bot?nica)
Facultat de Biologia
Universitat de Barcelona
Av. Diagonal 643
08028 Barcelona
SPAIN
---------------------------------------
phone: (+34) 934 039 863
fax: (+34) 934 112 842
---------------------------------------