check.code: Identify Unknown Plant Codes and Their Growth Habits and...

Description Usage Arguments Value

View source: R/gather.lpi.R

Description

Check a character string to see if it's a valid DIMA/AIM unknown plant code. Additionally, try to assign growth habit and duration for that code if possible.

Usage

1
check.code(code, valid.structure = "^(AF|AG|PF|PG|SH|TR)\\d{2,3}$")

Arguments

code

Character string. The string to check against the unknown plant code patterns

valid.structure

Regular expression as a character string. Define what the acceptable structure is for unknown plant codes. Defaults to the AIM format of "^(AF|AG|PF|PG|SH|TR)\d{2,3}$".

Value

A named list with three values. valid is logical and indicates if the code was a valid unknown. The remaining values match the style of DIMA's tblSpeciesGrowthHabit. habit, a character string, will be NULL if the code was not valid and either "Woody" or "Non-woody" as appropriate if it was valid. subhabit, a character string, will be NULL if the code was not valid and "Forb/herb", "Graminoid", "Shrub", or "Tree" as appropriate if it was valid. duration, a character string, will be NULL if the code was not valid and either "Annual" or "Perennial" as appropriate if it was valid.


nstauffer/dima.tools documentation built on May 20, 2019, 2:09 p.m.