forest_mapWoodyTables {medfate} | R Documentation |
Map forest plot data
Description
Mapping functions to facilitate building forest objects from forest plot data
Usage
forest_mapTreeTable(x, mapping_x, SpParams, plot_size_x = NULL)
forest_mapShrubTable(y, mapping_y, SpParams, plot_size_y = NULL)
forest_mapWoodyTables(
x = NULL,
y = NULL,
mapping_x = NULL,
mapping_y = NULL,
SpParams,
plot_size_x = NULL,
plot_size_y = NULL
)
Arguments
x |
A data frame with tree records in rows and attributes in columns. Tree records can correspond to individual trees or groups of trees with an associated density. |
mapping_x |
A named character vector to specify mappings of columns in |
SpParams |
A data frame with species parameters (see |
plot_size_x |
The size of tree plot sampled area (in m2). Alternatively, 'plot_size_x'
can be a column in |
y |
A data frame with shrub records in rows and attributes in columns. Records can correspond to individual shrubs (with crown dimensions and height) or groups of shrubs with an associated cover estimate. |
mapping_y |
A named character vector to specify mappings of columns in
|
plot_size_y |
The size of shrub plot sampled area (in m2). Alternatively, 'plot_size_y'
can be a column in |
Value
Functions forest_mapTreeTable
and forest_mapShrubTable
return a data frame with the structure of treeData
and shrubData
from forest
objects. Function forest_mapWoodyTable
returns directly a forest
object.
Author(s)
Miquel De Cáceres Ainsa, EMF-CREAF
See Also
forest
, poblet_trees
, forest_mergeTrees
, tree2forest
Examples
# Load species parameters
data(SpParamsMED)
# Create an empty forest object
f <- emptyforest()
# (1) Mapping tree data
# Load Poblet tree data
data(poblet_trees)
# Subset control plot
x <- subset(poblet_trees, Plot.Code=="POBL_CTL")
# Estimate sampled area (15-m radius plot)
sampled_area <- pi*15^2
# Define mapping
mapping_x <- c("Species.name" = "Species", "DBH" = "Diameter.cm")
# Map tree data for plot 'POBL_CTL'
f$treeData <- forest_mapTreeTable(x,
mapping_x = mapping_x, SpParams = SpParamsMED,
plot_size_x = sampled_area)
# (2) Mapping shrub individual data
#
# Create the individual shrub data frame
species <- c("Erica arborea","Cistus albidus", "Erica arborea", "Cistus albidus", "Cistus albidus")
H <- c(200,50,100,40,30)
D1 <- c(140,40,100, 35,30)
D2 <- D1
y <- data.frame(species, H, D1, D2)
# Define mapping (D1 and D2 map to variables with the same name)
mapping_y <- c("Species.name"= "species", "Height" ="H", "D1", "D2")
# Map individual shrub data to cover data (here each individual becomes a cohort)
# assuming that the sampled area was 4 m2
f$shrubData <- forest_mapShrubTable(y,
mapping_y = mapping_y, SpParams = SpParamsMED,
plot_size_y = 4)
# (3) Print forest attributes
summary(f, SpParamsMED)
# (4) Forest initialization in a single step
f <- forest_mapWoodyTables(x, y,
mapping_x = mapping_x, mapping_y = mapping_y,
SpParams = SpParamsMED,
plot_size_x = sampled_area, plot_size_y = 4)
summary(f, SpParamsMED)