hunter-stanke / rFIA

rFIA
https://rfia.netlify.com/
47 stars 23 forks source link

Ignore empty tables when loading FIA #8

Closed marekpetrik closed 4 years ago

marekpetrik commented 4 years ago

The following code fails:

library(rFIA)
db <- getFIA(states = c('NH','VT','ME', 'NY'), dir = 'data', common = TRUE)
fiaNE <- readFIA('data', common = FALSE, states = c('ME', 'NY','VT', 'NH'))
tpaNE <- tpa(fiaNE)

The problem occurs because some CSV files are empty. In this case, it is one of the VT files. The updated code skips over empty data.tables when loading them all to the list.

hunter-stanke commented 4 years ago

Excellent catch Marek! Thanks so much for contributing a fix - please let me know if you run into any other problems, always happy to help! Thanks again.

Hunter