lotze / COMPoissonReg

COMPoissonReg R package
GNU General Public License v2.0
8 stars 4 forks source link

Some functions fail if package is not loaded #8

Closed andrewraim closed 3 years ago

andrewraim commented 3 years ago

The following issue was reported by a user when attempting to use rcmp and rzicmp before the package is loaded. It looks like a C++ vector is empty...

R> COMPoissonReg::rcmp(n=10, lambda=1, nu = 1.5)
Error in rcmp_cpp(n, prep$lambda, prep$nu, ymax = ymax) : 
  Expecting a single value: [extent=0].
R> COMPoissonReg::rzicmp(n=10, lambda=1, nu = 1.5, p = 0.5)
Error in rcmp_cpp(n, prep$lambda, prep$nu, ymax = ymax) : 
  Expecting a single value: [extent=0].
andrewraim commented 3 years ago

This was caused by internal calls to getOptions before the package was loaded. The options were being set to default values at package load time. All calls to getOptions now include a default value so that functions can be called without loading the package.