[R] (no subject)
adrian at maths.uwa.edu.au
adrian at maths.uwa.edu.au
Wed Aug 15 04:39:00 CEST 2007
"Lawrence D. Brenninkmeyer" <ldb at outsourcethinking.com> writes:
> I am trying to find a way to diffuse GIS data on a European map. I have a
> dataset consisting of particular locations scattered across Europe,
> along with magnitude and value information.
The dataset is a spatial point pattern, where the locations are points,
and the value or magnitude is a `mark' attached to the point.
You can use the package 'spatstat' to smooth the values.
library(spatstat)
# extract coords
xy <- geocode[,c("LONG","LAT")]
# make an enclosing rectangle
Box <- ripras(xy, shape="rectangle")
# create point pattern
X <- as.ppp(xy, Box) %mark% (geocode$VALUE)
# visual check
plot(X)
# smooth using density.ppp
smoothVP <- density(X, weights = X$marks)
smoothP <- density(X)
smoothV <- eval.im(smoothVP/smoothV)
# inspect
plot(smoothV)
The result 'smoothV' is a pixel image (object of class "im") that you can
manipulate, threshold, take histograms, etc
# plot the region where smoothed value exceeds 42
plot(solutionset(smoothV > 42))
More information about the R-help
mailing list