雛が元の巣の場所から翌年確立した領域まで移動した距離を測定しようとしています. spatstat パッケージを使用してこれを実行したいのですが、一部の関数 (nncross、nndist、crossdist など) で出力に問題があります。私のコードは次のようになり、データは次のとおりです: https://sites.google.com/site/datastackoverflow/shapefiles
library(raster)
library(spatstat)
library(maptools)
# read in shapefile with nest locations (UTMs) and convert to ppp format:
nests <- readShapeSpatial("nest_locs.shp")
X<-as.ppp(nests)
X
# read in shapefile with juvenile locations (UTMs) and convert to ppp format:
juvs <- readShapeSpatial("juv_locs.shp")
Y<-as.ppp(juvs)
Y
# calculate the distance between nest points and juveniles:
N<-nncross(X,Y)
N
# another option
crossdist(X, Y)
結果は次のようになります。
> crossdist(X, Y)
[,1] [,2]
[1,] 2756.546 1994.002
[2,] 3831.429 3466.360
ポイント ID を保持することは可能ですか? この場合、行番号と列番号の代わりに、巣 ID と対応する鳥 ID を保持できますか?