| 1 |
|
| 2 |
R version 4.3.1 (2023-06-16) -- "Beagle Scouts" |
| 3 |
Copyright (C) 2023 The R Foundation for Statistical Computing |
| 4 |
Platform: x86_64-pc-linux-gnu (64-bit) |
| 5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY. |
| 7 |
You are welcome to redistribute it under certain conditions. |
| 8 |
Type 'license()' or 'licence()' for distribution details. |
| 9 |
|
| 10 |
R is a collaborative project with many contributors. |
| 11 |
Type 'contributors()' for more information and |
| 12 |
'citation()' on how to cite R or R packages in publications. |
| 13 |
|
| 14 |
Type 'demo()' for some demos, 'help()' for on-line help, or |
| 15 |
'help.start()' for an HTML browser interface to help. |
| 16 |
Type 'q()' to quit R. |
| 17 |
|
| 18 |
> options("rgdal_show_exportToProj4_warnings"="none") |
| 19 |
> library(sp) |
| 20 |
> data(meuse) |
| 21 |
> data(meuse.grid) |
| 22 |
> coordinates(meuse) = ~x+y |
| 23 |
> coordinates(meuse.grid) = ~x+y |
| 24 |
> x = coordinates(meuse) |
| 25 |
> y = coordinates(meuse.grid) |
| 26 |
> out = spDists(meuse,meuse.grid) |
| 27 |
> out2 = as.matrix(dist(rbind(coordinates(meuse),coordinates(meuse.grid)))) |
| 28 |
> out2 = out2[1:155,155+1:nrow(y)] |
| 29 |
> # should be equal: |
| 30 |
> all.equal(out2, out, check.attributes = FALSE) |
| 31 |
[1] TRUE |
| 32 |
> out = spDists(meuse.grid, meuse) |
| 33 |
> all.equal(out2, t(out), check.attributes = FALSE) |
| 34 |
[1] TRUE |
| 35 |
> |
| 36 |
> proc.time() |
| 37 |
user system elapsed |
| 38 |
1.106 0.204 1.306 |