datLUTspp: Data - Gets variable description or class for SPCD.

View source: R/datLUTspp.R

datLUTsppR Documentation

Data - Gets variable description or class for SPCD.

Description

Merge the ref_species table to append new variables, names, or categories to x.

Usage

datLUTspp(
  x = NULL,
  uniquex = NULL,
  NAclass = "Other",
  group = FALSE,
  states = NULL,
  spcdname = "COMMON",
  add0 = FALSE,
  stopifmiss = FALSE,
  xtxt = NULL,
  dsn = NULL,
  dbconn = NULL,
  dbconnopen = FALSE,
  dbwrite = FALSE,
  dbreturn = TRUE,
  overwrite = TRUE,
  savedata = FALSE,
  savedata_opts = NULL,
  gui = FALSE
)

Arguments

x

Data frame or comma-delimited file (*.csv). The data table with variable to classify.

uniquex

String. Unique values of SPCD to match, if x is NULL.

NAclass

String. NA values in xvar will be changed to NAclass.

group

Logical. If TRUE, the group variable in ref_species are merged to data table (E_SPGRPCD, W_SPGRPCD), depending on state(s) specified. If states overlap both E and W regions, the region with majority is used or E if equal. The group name is merged from ref_codes, SPGRPCD Variable.

states

String. Name of state(s) the x table is from.

spcdname

String. Name for species output type ('COMMON', 'SCIENTIFIC', 'SYMBOL', 'COMMON_SCIENTIFIC').

add0

Logical. IF TRUE, keep all codes in look up table. If FALSE, only include codes that are in x.

stopifmiss

Logical. IF TRUE, stops function if missing codes in LUTx.

xtxt

String.* Name of x table for more useful information in warnings.

dsn

String. Data source name of database with x.

dbconn

Open database connection.

dbconnopen

Logica. If TRUE, keep database connection open.

dbwrite

Logical. If TRUE, write class column to database table x.

dbreturn

Logical. If TRUE, return table with class column.

overwrite

Logical. If TRUE, and the class name already exists in x, overwrites class name.

savedata

Logical. If TRUE, saves data to outfolder.

savedata_opts

List. See help(savedata_options()) for a list of options. Only used when savedata = TRUE. If out_layer = NULL, default = 'datlut'.

gui

Logical. If gui, user is prompted for parameters.

Value

xLUT

The input data table with look-up table variable(s).

xLUTnm

Name of the new variable(s).

LUT

Look up table with categories.

If savedata = TRUE, a comma-delimited file is output to the outfolder as outfn. If outfn = NULL, the name of the file will be datlut_'date'.csv.

Note

For available reference tables: sort(unique(ref_codes$VARIABLE))

Author(s)

Tracey S. Frescino

Examples

WYtreelut <- datLUTspp(WYtree)
names(WYtreelut)
WYtree2 <- WYtreelut$xLUT
head(WYtree2)

FIESTA documentation built on Nov. 22, 2023, 1:07 a.m.