Skip to content
Prev 8371 / 29559 Next

Better print method for Spatial*DataFrames?

On Sat, 29 May 2010, Barry Rowlingson wrote:

            
Right, because they see S4 objects as lists with no components, only with 
attributes. str() does have support for S4 objects. They would need to be 
wrapped around an S4 show/print method, with the output captured, as in 
capture.output(). Would it make sense to have the default print/show for 
Spatial* be str() with max.level= set, and for Spatial*DataFrame be the 
print method for the data slot prepended with some text (perhaps POINT, 
MULTILINESTRING, MULTIPOLYGON, PIXEL, CELL, or better an abbreviation)?

One would do this by cbind()ing the text in front of the as(, 
"data.frame"), I think, as a "geometry" variable.

Roger