【发布时间】:2019-04-02 21:33:38
【问题描述】:
我有一个 93 行的超帧。每行包含 ppp 类树的茎图以及绘图级别分组因子。标记数据框提供点特定数据,例如每个点的直径、种类和高度。 我需要根据标记的数据框对点模式进行子集化,然后运行 L est 函数,这需要合并数据。我找到了单点模式的子集标记示例和基于超帧列的超帧子集示例,但我还没有看到从具有多个标记的数据帧调用因子级别的超帧的子集点模式示例。任何指导将不胜感激。
我可以通过地块级别因子对超帧进行子集化,比如说 a、b 和 c 植被类型,然后为每个地块运行 Lest,根据植被类型汇集输出,并绘制汇集的 Lest(第 684 页) Baddeley et al. 2015 提供了一个有用的例子)。
但是,我未能根据数据帧的特定标记对超帧的点模式进行子集化。我不确定我的数据结构是否会导致问题,所以我在下面包含了,或者我只是对将与超帧的多个点模式相关联的数据帧标记子集的代码感到困惑(这里是 R 新手。列表中的列表变得混乱)。
数据构建:
z.list <- mapply(as.ppp, X = df.list, W = window.list, SIMPLIFY=FALSE)
#df.list contains x,y coordinates, followed by columns of point specific
#data.
h <- hyperframe(X=z.list)
H <- cbind.hyperframe(h, plot.df1)#combine the point pattern and marks
#with plot level data
数据结构:
str(H)
'hyperframe': 93 rows and 14 columns
$ X : objects of class ppp
$ PLOTID : factor 0102U001 0104U001 0104U002 ...
$ Group1 : integer 1 2 1 ...
$ Group2 : numeric 2.0 2.5 2.0 ...
str(H[1,]$X) #str of the ppp of the hyperframes first row
List of 1
$ X:List of 6
..$ window :List of 5
.. ..$ type : chr "polygonal"
.. ..$ xrange: num [1:2] 516441 516503
.. ..$ yrange: num [1:2] 3382698 3382804
.. ..$ bdry :List of 1
.. .. ..$ :List of 2
.. .. .. ..$ x: num [1:4] 516503 516502 516441 516442
.. .. .. ..$ y: num [1:4] 3382698 3382804 3382804 3382698
.. ..$ units :List of 3
.. .. ..$ singular : chr "metre"
.. .. ..$ plural : chr "metres"
.. .. ..$ multiplier: num 1
.. .. ..- attr(*, "class")= chr "unitname"
.. ..- attr(*, "class")= chr "owin"
..$ n : int 107
..$ x : num [1:107] 516501 516473 516470 516474 516474 ...
..$ y : num [1:107] 3382801 3382723 3382726 3382734 3382732 ...
..$ markformat: chr "dataframe"
..$ marks :'data.frame': 107 obs. of 3 variables:
.. ..$ DBH_Class: Factor w/ 16 levels "11.25","13.75",..: 7 5 13 12 8 4 9
.. ..$ Ingrowth : Factor w/ 7 levels "DD","I_DD","I_LD_MY",..: 7 6 6 7
.. ..$ PlotID : Factor w/ 93 levels "0102U001","0104U001",..: 1 1 1 1
..- attr(*, "class")= chr "ppp"
- attr(*, "class")= chr [1:5] "ppplist" "solist" "anylist" "listof" ...
以上对我来说似乎是正确的,但我注意到尽管标记使用 str 函数打印,is.multipoint 输出为FALSE。不确定这是否是我的问题的一部分。
以下对于位于超帧行中的绘图级别因子非常有用。
H$L <- with(H, Lest((X),rmax=40))
L.VT.split <- split(H$L, H$VEG_TYPE) #plot level factor
L.VT.pool <- anylapply(L.VT.split, pool)
plot(L.VT.pool,cbind(pooliso, pooltheo, hiiso,loiso)-r~r,
shade=c("hiiso","loiso"),equal.scales=TRUE, main='')
但是如何使用数据帧中的标记执行相同的操作?
【问题讨论】: