私はたくさんの座標を持っています:
> xh1
[1] 257283.7 258592.6 261811.6 262768.6 257283.7
> yh1
[1] 2639722 2640722 2640722 2639722 2639722
> xh2
[1] 257283.7 256523.3 263725.6 262768.6 257283.7
> yh2
[1] 2639722 2638722 2638722 2639722 2639722
... ...
「cbind」を使用して、ポリゴンに変換する座標を次のように準備します。
poly1<-cbind(xh1,yh1)
poly2<-cbind(xh2,yh2)
... ...
> poly1
xh1 yh1
[1,] 257283.7 2639722
[2,] 258592.6 2640722
[3,] 261811.6 2640722
[4,] 262768.6 2639722
[5,] 257283.7 2639722
... ...
poly<- Polygon(poly1)
... ...
Rで「cbind」タスクを実行するためにループを使用することは可能ですか?? 以下のようなものは機能しないことを知っています。
poly<-lapply(1:100, function(i) cbind(paste0("xh",i), paste0("yh",i)))