Skip to content
Prev 1004 / 29559 Next

Importing and Handling DXF Map files in R

On Thu, 11 May 2006, Roger Bivand wrote:

            
Replying to my own question, kernel2d() scales brilliantly:

set.seed(1)
cores <- cbind(x=runif(300), y=runif(300))
out <- do.call("rbind", lapply(1:300, function(i) 
  cbind(x=cores[i,1]+rnorm(200, 0, runif(1, 0.001, 0.02)), 
  y=cores[i,2]+rnorm(200, 0, runif(1, 0.001, 0.02)))))
plot(out, pch=".")
plot(hexbin(out))
image(kernel2d(out, bboxx(bbox(out)), h0=0.05, 50, 50), 
  col=grey(99:1/100))

plot(hexbin()) 1.4 seconds 
image(kernel2d()) 1.0 seconds

and the new spkernel2d() wrapper makes it convenient to stack up kernel 
densities in a SpatialGridDataFrame and display with spplot().