[R-sig-Geo] How to deal with missing values in geospatial data

Roger Bivand Roger.Bivand at nhh.no
Mon Apr 13 21:58:03 CEST 2009


On Mon, 13 Apr 2009, Everton Emanuel wrote:

> Dear all,
>
> I am doing some spatial analysis for the Federal Unities of Brazil. At this
> point I am dealing with some  problems concerning "missing values" in the
> spatial data set. My question is:
>
> How can I create maps if I have missing values in some spatial units?

The spplot, plot, and image methods treat NAs (assuming that you have set 
your missing values to NA) as other R graphics methods - they show the 
background colour. So you can in general ignore the NAs, or if need be 
reset the background colour:

library(sp)
data(meuse.grid)
coordinates(meuse.grid) <- c("x", "y")
gridded(meuse.grid) <- TRUE
summary(meuse.grid$dist)
image(meuse.grid, "dist", axes=TRUE)
is.na(meuse.grid$dist) <- meuse.grid$dist < 0.3
summary(meuse.grid$dist)
image(meuse.grid, "dist", axes=TRUE)

Hope this helps,

Roger

>
> Can I solve this problem by inputing values to this lacks of information?
>
> Thank you all,
> Everton.
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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



More information about the R-sig-Geo mailing list