Checks a tree mapping dataset for missing data and formatting that could lead to errors when applying other functions in this package. Outputs a table of the trees with data issues and a table summarizing the number of trees in the mapping dataset that have data issues.

mapping_check(map_data, max_x, max_y)

Arguments

map_data

Data frame containing tree mapping data. Should contain the columns tree_id, stand_id, species, x_coord, and y_coord. Any additional columns will be ignored by this function.

max_x

Maximum expected x coordinate (i.e. should be 100 if the stands are 100 x 100 m).

max_y

Maximum expected y coordinate.

Value

A list containing two elements:

  • problem_trees is a data frame containing the rows of map_data that contain data issues. An additional column describes the identified issue

  • issue_summary is a data frame that shows the number and percentage of trees with at least one issue and with each of the specific issues

Details

The data issues checked for are: presence of required columns, duplicated tree ids, missing x or y coordinates, x or y coordinates outside the expected range, missing stand id or species information. This function does not check for misspelled stand ids or species, which should be checked independently.

Examples

map_check_test <- mapping_check(messy_mapping, 100, 100)
#> [1] "This is version 0.2.0!" #> [1] "Potential formatting problems detected: please review output and correct errors or remove problem trees if necessary before continuing analysis"