View spatial data attribute tables in R

Tue 14 October 2008

Many GIS offer the ability to view the attribute table of a vector layer. While this is perhaps less obvious in the R environment, it is not impossible. The following command allows you to visually inspect, and change any data.frame (or other vector, matrix, etc.), including Spatial*DataFrames.

invisible(edit(spatial_layer@data))

Note: invisible allows you to close the viewer without filling the console with the attributes of the table. You could also use:

new_data = edit(spatial_layer@data)

to assign changes made to the data to a new variable, or use:

spatial_layer@data = edit(spatial_layer@data)

or,

fix(spatial_layer@data)

to make changes to the Spatial*DataFrame itself.

Helpful Tip

FOSS GIS How-To R

twitter

recent visitors