if(interactive()) {
D <- density(chicago, 150)
A <- transect(D, path=c(1, 248))
} else {
Z <- as.im(function(x,y) {x-y}, Frame(simplenet))
D <- linim(simplenet, Z)
A <- transect(D, path=c(1, 7), nsample=32)
}
opa <- par(mfrow=c(1,2))
plot(A, main="transect")
plot(D, main="image")
plot(attr(A, "lines"), add=TRUE, col=8, lwd=7)
par(opa)
attr(A, "path")
npoints(attr(A, "SamplePoints"))
## linfun example
DS <- distfun(spiders)
ns <- if(interactive()) 512 else 32
TDS <- transect(DS, path=c(95,99), nsample=ns)
plot(TDS)
Run the code above in your browser using DataLab