Open radt0005 opened 11 months ago
Thank you for pointing out this issue and for providing detailed information and possible solution. We have anticipated the use of RPostgreSQL, but have focused on SQLite databases, so we have not come across this error. We are working on incorporating a fix for the next version. Your help is much appreciated.
This should be reproducible but I'm not sure it qualifies as a bug. It seems like an unanticipated interaction between FIESTA and the RpostgreSQL package. Here are some details:
In a fresh R session run the first modGBpop example from the FIESTA - Green-book Estimators vignette POP1: FIADB POPULATION - Get population data for area and tree estimates for Wyoming, using post-stratification
next run the first modGBtree example from the same vignette POP1: 1.1 Net cubic-foot volume of live trees, Wyoming, 2011-2013
Everything works fine to here. But if you load the RpostgreSQL package and run the modGBtree example again it causes an error
library(RPostgreSQL)
Checking for and detaching the RPostgreSQL package before running the modGBtree code will solve the problem. A possible modification to the FIESTA code in datSumTree.R to specify SQLite driver the drv="RSQLite" at line 688 (and possibly line 708) seems to prevent the error in this example:
sqldf::sqldf(tree.qry, dbname=dbname, drv="RSQLite")
I'm not sure if this would cause other problems, but I wanted to pass it along in case it helps anyone who might have RPostgreSQL loaded in their environment while calling FIESTA functions. Thank you!