Message-ID: <Pine.LNX.4.44.0612072030030.5021-100000@reclus.nhh.no>
Date: 2006-12-07T19:32:56Z
From: Roger Bivand
Subject: making a grid of points
In-Reply-To: <1165518188.1551.36.camel@iron.psg.net>
On Thu, 7 Dec 2006, Ross Boylan wrote:
> I'd like to evaluate a function at each point on a 2 or 3-D grid. Is
> there some function that already does this, or generates the grid of
> points?
>
> My search has led me to the grid and lattice packages, and I found a
> reference to the sp package (e.g., SpatialGrid) for this. There are
> things in there that might be relevant, but at first blush many of them
> are embedded in other concepts (grobs, shingles, rugs) and don't
> obviously solve the problem.
>
> I know this is not a hard thing to program, but I suspect someone has
> already done it. Any pointers?
Which "space" are your points in? The sp package might help if the data
are spatial/geographical, but I think that expand.grid() is your friend,
followed by one of the apply() family to run your function on each row of
the data frame output by expand.grid().
Roger
>
> Thanks.
>
--
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