Learn R Programming

medfate (version 4.7.0)

forest_mapWoodyTables: 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 )

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.

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 x into attributes of treeData data frames. Accepted names (and the corresponding specifications for the columns in x are:

SpParams

A data frame with species parameters (see SpParamsMED) from which valid species names are drawn.

plot_size_x

The size of tree plot sampled area (in m2). Alternatively, 'plot_size_x' can be a column in x and specified in mapping_x to indicate that trees have been measured in different subplots and, therefore, they represent different densities per hectare.

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 y into attributes of shrubData data frames. Accepted names (and the corresponding specifications for the columns in y) are:

  • "Species": Species code (should follow codes in SpParams).

  • "Species.name": Species name. In this case, the species code will be drawn by matching names with species names in SpParams.

  • "N": Tree density (in ind./ha).

  • "Cover": Shrub cover (in %).

  • "D1": Shrub largest crown diameter (in cm).

  • "D2": Shrub crown diameter orthogonal to the largest one (in cm).

  • "plot.size": Plot size (in m2) to which each record refers to. This is used to calculate tree density (stems per hectare) when not supplied or shrub cover when shrub data is given at the individual level.

  • "DBH": Diameter at breast height (in cm).

  • "Height": Tree or shrub height (in cm).

  • "Z50": Depth (in mm) corresponding to 50% of fine roots.

  • "Z95": Depth (in mm) corresponding to 95% of fine roots.

plot_size_y

The size of shrub plot sampled area (in m2). Alternatively, 'plot_size_y' can be a column in y and specified in mapping_y to indicate that shrubs have been measured in different subplots and, therefore, they represent different cover values.

Author

Miquel De Cáceres Ainsa, EMF-CREAF

See Also

forest, poblet_trees, forest_mergeTrees, tree2forest

Examples

Run this code

# 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)

Run the code above in your browser using DataLab