expandedge: Expand the edges for the point pattern with replication.

expandedgeR Documentation

Expand the edges for the point pattern with replication.

Description

When computing forest spatial structure indices, The trees near the edges of the study region are distorted because the outside is empty. Common solutions to this problem are not to use indices computed for trees near the edges, or (with rectangular regions) to attach translated copies, thus changing the topology into a torus.

Usage

expandedge(X, xwidth, ywidth, id = 1:X$n)

Arguments

X

A point pattern (object of class "ppp").

xwidth

Distance from the edges x coordinates,note xwidth is the half of your width wanted, because the width will expand both edges in the x coordinates.

ywidth

Distance from the edges y coordinates,note xwidth is the half of your width wanted, because the width will expand both edges in the y coordinates.

id

Specific identification number of the points in the point pattern.

Details

When expanding for the full pattern, and using expandedge() with a positive xwidth and ywidth; conversely, shrinking for the full pattern, and using shrinkedge () with a negative xwidth and ywidth.

Value

Result returns original data (not a a point pattern with the same structure as trees), id is new id of points after edges expanded and old.id is orginal id of points. The pattern is first expanded by surrounding it with 8 shifted copies (the window must be rectangular). Then, the parts of the pattern that are at a distance less than xwidth or ywidth from an edge of the enlarged pattern are discarded. If xwidth or ywidth = 0, trees are returned unchanged.

Author(s)

Zongzheng Chai, chaizz@126.com

Examples

library(spatstat.data)
data(finpines)
finpines$window
# window: rectangle = [-5, 5] x [-8, 2] metres

# Expand the rectangle [-5,5]x[-8,2] to [-6,6]x[-9,3]
Expand.trees<- expandedge(finpines,xwidth=2,ywidth=1,id=1:126)
Expand.trees

# Show the changes by figures
opar<-par(mfrow=c(1,2))
plot(finpines$x,finpines$y)
text(finpines$x,finpines$y,1:126)
plot(Expand.trees$x,Expand.trees$y)
text(Expand.trees$x,Expand.trees$y,Expand.trees$old.id)
rect(-5,-8,5,2,border="red")
par(opar)

Zongzheng/forestSAS documentation built on July 13, 2024, 8:12 p.m.