Skip to content
Prev 9102 / 29559 Next

Spatial data tower of babel

Rather something like this in the simplest form; i.e. using an S4
method for inheritance, and passing it on to other packages as much as
possible.

setMethod('convert', signature(x='ANY', class='character'),
function(x, class, ...) {
       y <- try( as(x, class), silent=TRUE )
       if (class(y) == 'try-error') { stop('sorry')    } else {  return(y) }
} )

And adding more methods for classes that do not have as methods. Most
objects could be coerced into an sp object, and then into whatever is
requested. Perhaps there is a lot of ugly nitty-gritty there. Perhaps
you are right about dependencies and S4.

Still, I think this could be a step forward from the current situation
where many no standard coercion functions exist that might be hard to
find or remember.

Robert


On Wed, Aug 25, 2010 at 1:03 PM, Edzer Pebesma
<edzer.pebesma at uni-muenster.de> wrote: