get_neighbor_variables: get_neighbor_variables

get_neighbor_variablesR Documentation

get_neighbor_variables

Description

function to obtain the attributes of all the neighbors of a given set of target trees

Usage

get_neighbor_variables(df, var, self_del = T, ...)

Arguments

df

the data frame containing information about the target trees.

var

The variable that we want to extract from the neighbors. It can be either a numeric, logical or character variable.

self_del

If 'TRUE', a tree is not included as a neighbor of itself. If 'FALSE' the attribute if the target tree will be also included in the output as a neighbor of itself.

...

optional. Character or numeric variable that identifies the plots, or experimental units, within which the neighbors will be considered. This information is used to split the calculations per plot, and the results are merged back into a single data frame. A tree 'b' will not be considered as a neighbor of tree 'a' unless they belong to the same plot. If this argument is missing, all trees in 'df' will be considered both targets and neighbors.

Details

get_neighbor_variables

Value

a data frame containing as many rows as target trees, and as many columns as the maximum number of neighbors per tree. Cells contain values of the variable "var" for each neighbor tree, and missing values are coded as 'NA'.

Examples


data(tree_data)

# Get dbhs of all the neighbors, as if they were all in the same plot
dbhs <-get_neighbor_variables(tree_data, var = dbh, self_del = F)

# Get species of all the neighbors (incuding target tree as its own neighbor)
species <-get_neighbor_variables(tree_data, var = sps, plot, self_del = T)


ameztegui/neighborhood documentation built on April 13, 2022, 5:51 p.m.