[R-sig-Geo] C API for sp classes?
Edzer J. Pebesma
e.pebesma at geo.uu.nl
Tue Mar 7 22:52:06 CET 2006
Barry Rowlingson wrote:
>Wouter Buytaert wrote:
>
>
>
>>The resulting R function doesn't seem very complicated. I'm a newbie
>>though, so all recommendations welcome:
>>
>>topidx <- function(map) {
>>
>>if(!(class(map) == "SpatialGridDataFrame"))
>> printf("Map should be of SpatialGridDataFrame class")
>>
>>
>>
>
> Recommendation number 1 - read all about Object-Oriented Programming!
>
>
>
Wouter, I have never completely understood Barry's reservations against
the S4 object orientation framework, which he never managed (or wanted?) to
get a real grip on; please don't let it intimidate you. There are many
ways of
checking for classes; I would prefer is(map, "SpatialGridDataFrame") because
it will then work as well for classes that are derived from
SpatialGridDataFrame.
Another issue in this thread: R namespaces and S4 classes are two rather
different issues; at some areas they even seem not to work together too
well.
Ask Roger (in private, please!) for details, or search through r-devel.
>Otherwise, I vote for .Call() :)
>
>
>
I managed to have package gstat using exclusively .Call() at some
stage, but had to work into poorly documented areas of this interface:
R has quite a different way of dealing with strings than that documented
in the green book (Programming with data, J. Chambers).
The final pleasure was mostly that of aesthetics, and had nothing
to do with "good code".
--
Edzer
More information about the R-sig-Geo
mailing list