hunter-stanke/rFIA

readFIA throws an error

danfosterfire opened this issue · 3 comments

The following code is throwing an error in version 0.2.4:

# download FIA data for CA, OR, and NV. Write to a local directory; or if it's 
# already been downloaded, just read it from the local 
fiadb = 
  if (!file.exists(here::here('02-data', '00-source', 'fia', 'CA_PLOT.csv'))){
    getFIA(states = c('CA', 'OR', 'NV'),
           dir = here::here('02-data',
                            '00-source',
                            'fia'))
  } else {
    readFIA(here::here('02-data',
                       '00-source',
                       'fia'))
    
  }

I'm getting the error message Error in rbindlist(inTables[names(inTables) == uniqueNames[i]]) : Class attribute on column 15 of item 3 does not match with column 15 of item 1.

Am I doing something wrong or is this a bug?

This is a bug that arose following the most recent release of data.table - I've implemented a short term fix in the development version of rFIA available on GitHub, and will be rolling out a more comprehensive fix for CRAN in the next few months.

I just tested it out with the dev version (install with devtools::install_github('hunter-stanke/rFIA')) and all is working for those states on my end. If you haven't already, could you install the dev version of rFIA and give it another try? If you run into the same error after a fresh GitHub install let me know and I'll get a temporary fix up today.

Sorry about the hassle! Again, I'll be rolling out a more comprehensive fix along with some major speed and memory improvements by the end of the year.

Also, the dev version of rFIA requires JAGS to be installed on your machine, and will throw an error on install if JAGS is not found. I'm working on making this error more informative, but for now if you don't have JAGS installed you can download it from sourceforge:

Windows: https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/
Mac: https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Mac%20OS%20X/
Linux sudo apt-get install -y jags

Dev version is working fine on my end, thanks for the quick fix!