Merge the ref_species table to append new variables, names, or categories to x.
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
)
Data frame or comma-delimited file (*.csv). The data table with variable to classify.
String. Unique values of SPCD to match, if x is NULL.
String. NA values in xvar will be changed to NAclass.
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.
String. Name of state(s) the x table is from.
String. Name for species output type ('COMMON', 'SCIENTIFIC', 'SYMBOL', 'COMMON_SCIENTIFIC').
Logical. IF TRUE, keep all codes in look up table. If FALSE, only include codes that are in x.
Logical. IF TRUE, stops function if missing codes in LUTx.
String.* Name of x table for more useful information in warnings.
String. Data source name of database with x.
Open database connection.
Logica. If TRUE, keep database connection open.
Logical. If TRUE, write class column to database table x.
Logical. If TRUE, return table with class column.
Logical. If TRUE, and the class name already exists in x, overwrites class name.
Logical. If TRUE, saves data to outfolder.
List. See help(savedata_options()) for a list of options. Only used when savedata = TRUE. If out_layer = NULL, default = 'datlut'.
Logical. If gui, user is prompted for parameters.
The input data table with look-up table variable(s).
Name of the new variable(s).
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.
For available reference tables: sort(unique(ref_codes$VARIABLE))
WYtreelut <- datLUTspp(WYtree)
names(WYtreelut)
#> [1] "xLUT" "xLUTnm" "LUT" "ref_spp"
WYtree2 <- WYtreelut$xLUT
head(WYtree2)
#> Key: <SPCD>
#> SPCD PLT_CN CONDID SUBP TREE STATUSCD SPGRPCD DIA HT
#> <num> <char> <num> <num> <num> <num> <num> <num> <num>
#> 1: 19 40404821010690 1 1 7 1 12 5.9 48
#> 2: 19 40404821010690 1 1 8 1 12 8.1 45
#> 3: 19 40404821010690 1 1 11 2 12 NA NA
#> 4: 19 40404821010690 1 1 14 1 12 15.6 83
#> 5: 19 40404821010690 1 1 15 1 12 13.7 77
#> 6: 19 40404821010690 1 1 16 2 12 8.2 59
#> TREECLCD AGENTCD STANDING_DEAD_CD VOLCFNET VOLCFGRS VOLBFNET TPA_UNADJ
#> <num> <num> <num> <num> <num> <num> <num>
#> 1: 2 NA NA 3.162918 3.162918 NA 6.018046
#> 2: 2 NA NA 5.921927 5.921927 NA 6.018046
#> 3: NA 70 0 NA NA NA NA
#> 4: 2 NA NA 40.301980 40.301980 245.1420 6.018046
#> 5: 2 NA NA 29.384580 29.384580 164.8938 6.018046
#> 6: 3 70 1 8.244134 8.327408 NA 6.018046
#> DRYBIO_AG CARBON_AG BA COMMON_NAME
#> <num> <num> <num> <char>
#> 1: 124.0067 59.77124 0.1898537 subalpine fir
#> 2: 228.8041 110.28356 0.3578369 subalpine fir
#> 3: NA NA NA subalpine fir
#> 4: 1393.2114 671.52789 1.3272854 subalpine fir
#> 5: 991.9932 478.14072 1.0236613 subalpine fir
#> 6: 262.0124 131.26821 0.3667270 subalpine fir