View source: R/stemMappingExtension_square.R
stemMappingExtension_square | R Documentation |
The function extends stem mapping in a square plot to a target area and shape.
stemMappingExtension_square(
objectID,
bearing,
distance,
plotLength,
targetArea = 1,
targetShape = "square",
randomRotate = FALSE
)
objectID |
character, A object's ID, e.g., a tree's ID. |
bearing |
numeric, Bearing of a object from the north. It should be between 0 to 360. |
distance |
numeric, Distance between a object and the centre of the circle. |
plotLength |
numeric, Length of a square plot. |
targetArea |
numeric, Defines the area you may want to extend. The unit of this input is |
targetShape |
character, Defines the shape of the target area. It currently supports |
randomRotate |
logical, Defines whether need to random rotate the hexagon when merge into
a |
A table contains the x and y for all the objects in the extended area.
Yong Luo
## Not run:
## randomly generate some trees
library(data.table)
smallplottrees <- data.table(tree_id = 1:20,
angle = runif(20, min = 0, max = 360),
distance = runif(20, min = 0, max = 5.6))
## extend it to 1 ha
treelist_smallplot <- stemMappingExtension_square(objectID = smallplottrees$tree_id,
bearing = smallplottrees$angle,
distance = smallplottrees$distance,
radius = 5.64,
randomRotate = TRUE)
bigplottrees <- data.table(tree_id = 1:20,
angle = runif(20, min = 0, max = 360),
distance = runif(20, min = 0, max = 11.28))
## extend it to 1 ha
treelist_bigplot <- stemMappingExtension_square(objectID = bigplottrees$tree_id,
bearing = bigplottrees$angle,
distance = bigplottrees$distance,
radius = 11.28)
treelist_smallplot[, source := "smallplot"]
treelist_bigplot[, source := "bigplot"]
alltreelist <- rbind(treelist_bigplot, treelist_smallplot)
alltreeplot <- ggplot(data = alltreelist, aes(x, y))+
geom_point(aes(col = factor(source)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.