hunter-stanke/rFIA

'invasive' function not finding INVASIVE_SUBPLOT_SPP table

GaryBoba opened this issue · 1 comments

I've pulled the FIAPNW.db (using the manual method mentioned in another thread) and am trying to use the 'invasive' function on a FIA database. I've used the readFIA function to pull the CSVs into the database. Originally I ran 'invasives' and it told me that several tables were not found.
I re-read the CSVs into the database, specifying each table that was missing. Now all tables are in the database. I ran 'invasives' again and this time only one table, 'INVASIVE_SUBPLOT_SPP', was not found. All the other tables seem to be fine now, and even this table is listed with the others in the database.
I've checked the spelling and it matches. Am I missing something? Or is there something different about this particular table?

setwd("D:/Project/") FIAWA_InvTables<-readFIA(dir='WA', states='WA', tables=c('INVASIVES_PNWRS', 'INVASIVE_PLOT_SPECIES_TBL', 'INVASIVE_SUBPLOT_SPP_TBL', 'PLOT', 'SUBP_COND', 'COND', 'POP_PLOT_STRATUM_ASSGN', 'POP_ESTN_UNIT', 'POP_EVAL', 'POP_STRATUM', 'POP_EVAL_TYP', 'POP_EVAL_GRP')) invasives_test<-invasive(FIAWA_InvTables, byPlot=T, returnSpatial=T)

Returns this error:
> invasives_test<-invasive(FIAWA_InvTables, byPlot=T, returnSpatial=T) Error in readRemoteHelper(x, db, remote, reqTables, nCores) : INVASIVE_SUBPLOT_SPP tables not found in object db.

Here's the view of the database.
image

Any insight would be much appreciated!

I am not sure what exactly you want to pull out of the invasive file, but I have found a few bugs in some of the base functions. I think this is due to the new formatting of the most recent inventory/FIA dataset. But I don't know, yet - I am new to rFIA. Here is my work around - it works and you would just have to edit how you use group_by(SPCD, SUBPID) - if you wanted species groupings or edit for another. This won't spit out spatial data, but you could convert it.

d <- readFIA(fiadb_dir, states = "TN")
d <- clipFIA(d, mostRecent = TRUE) #most recent includes 2005
invasive<-d$INVASIVE_SUBPLOT_SPP
i_plant <- invasive %>%
  filter(CONDID == 1) %>%          #sorts by condition or whatever needed
  mutate(SUBPID = paste(UNITCD, STATECD, COUNTYCD, PLOT, SUBP, sep = '_'),
         Atotal=sum(COVER_PCT)) %>% #some calculation 
  group_by(SUBPID)
summary(i_plant)