Maybe xyFromCell(r1, 1:ncell(r1)) instead of coordinates ? You get the same
result, however there might be better memory management with xyFromCell (I
haven't checked).

I agree that 1:ncell(r1) or ncol()/nrow() could be a good default.

Etienne


2013/1/23 Michael Sumner <mdsumner@gmail.com>

> "Better" depends on what was required, which wasn't specified - all
> the coordinates, or just 1-d arrays of the unique ones. Our answers
> are totally different, Thiago I trust that you see the difference?
>
> It would be good if xFromCol / yFromRow had defaults for their second
> argument to return all if colnr/rownr are not specified.
>
> Robert: do you think that's a reasonable modification?  (Or are their
> already other functions for that?) :)
>
> Cheers, Mike.
>
> On Thu, Jan 24, 2013 at 12:33 AM, Barry Rowlingson
> <b.rowlingson@lancaster.ac.uk> wrote:
> > On Wed, Jan 23, 2013 at 12:06 AM, Michael Sumner <mdsumner@gmail.com>
> wrote:
> >> You can just do
> >>
> >> xy <- coordinates(r1)
> >>
> >> which gives a 2-column matrix with
> >>
> >> lon <- xy[,1]
> >> lat <- xy[,2]
> >>
> >> Note that for largish rasters this is a considerable amount of data,
> >> and it's mostly all redundant since you can generate it from the
> >> resolution and extent, so you might need to consider other options.
> >
> >  Better to use xFromCol and yFromRow!
> >
> > xFromCol(r,1:ncol(r))
> > yFromRow(r,1:nrow(r))
> >
> >  should do the job.
> >
> > Barry
>
>
>
> --
> Michael Sumner
> Hobart, Australia
> e-mail: mdsumner@gmail.com
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

