data(weather)
(coord <- weather[1:5, 3:4])
(z <- RFfctn(RMtrafo(CARTESIAN_COORD), coord))
(z1 <- RFearth2cartesian(coord)) ## equals t(z)
z1 - t(z) ## 0, i.e., z1 and t(z) are the same
dist(t(z))
(d <- RFearth2dist(coord))
d - dist(t(z)) ## 0, i.e., d and dist(t(z)) are the same
\dontrun{
## RFearth2dist is more precise !!!
library("fields")
(unix.time(z2 <- rdist.earth(coord, miles=FALSE)))
z2
(z2 - as.matrix(d)) / z2 * 100 ## RFearth2dist is more precise
#
n <- 10000
unix.time(for (i in 1:n) d <- RFearth2dist (coord))) ## the same as dist(t(z))
unix.time(for (i in 1:n)z2 <- rdist.earth(xx)))
data(weather)
xx <- matrix(weather[, 3:4], ncol=2) [ 1:5, ]
xx <- weather[, 3:4][ 1:5, ]
Print(xx)
Print(yy <- RFfctn(RMtrafo(iso=CARTESIAN_COORD), xx), units="miles")
(z1 <- as.matrix(dist(t(yy))))
library(fields)
(z2 <- rdist.earth(xx))
(z1-z2) / z1 * 100
z1
}
RFoptions(seed=NA)
Run the code above in your browser using DataLab