Downloads and extracts compressed comma-delimited file(s) (*.zip) from FIA DataMart (https://apps.fs.usda.gov/fia/datamart/CSV/datamart_csv.html). Only 1 table can be specified, but multiple states may be included.
DBgetCSV(
DBtable,
states = NULL,
returnDT = FALSE,
stopifnull = TRUE,
noIDate = TRUE
)
Returns a data table (returnDT=TRUE), or data.frame (returnDT=FALSE) of downloaded table(s). If more than one state, returned as one table.
String. Name of table to download. Only 1 table allowed.
String or numeric vector. Name (e.g., "Arizona", "New Mexico") or code (e.g., 4, 35) of states to download data. If NULL, tables that are not state-level are downloaded.
Logical. If TRUE, a data table is returned, else, a data frame.
Logical. If TRUE, stop if table is NULL.
Logical. If TRUE, do not include columns with type IDate.
Tracey S. Frescino
The compressed data files are downloaded from FIA DataMart; saved to a temporary space; extracted and imported; and deleted from temporary space. Accessibility and download time depends on access and speed of internet connection.
if (FALSE) {
# Get plot data for multiple states
FIAplots <- DBgetCSV("PLOT", c("Georgia", "Utah"))
table(FIAplots$STATECD)
}
Run the code above in your browser using DataLab