piLaboratory / GillesCom

Gillespie Simulation of Ecological Communities Dynamics
2 stars 0 forks source link

Rcpp::Function("warning") sends empty warnings during development #3

Closed andrechalom closed 8 years ago

andrechalom commented 8 years ago

I have included a Rcpp::Function warning("warning"); line in the C++ source code in order to send warnings from the C++ code to R, as suggested here. However, this seem to be generating warnings on some operations, such as loading the package with dev_tools and running dev_example:

> load_all()
Loading GillesCom
Warning messages:
1: character(0) 
2: character(0) 
> dev_example("Init_Community")
Loading GillesCom
Running examples in Community.Rd ------------------
> 
> # Initializes the community (in a global object)
> Init_Community(100)
> # Runs 50000 iteractions of the birth-death-migra
> for (i in 1:50000) bdm()
> # Gets and analyzes the abundance vector
> (ab <- as.numeric(abundance()))
(...ETC...)
> f <- sads::fitlnorm(ab[ab>0])
> plot(f, which=1)
> # Simulation internal time elapsed
> time()
[1] 7.348134
Warning message:
character(0) 

These warnings are not thrown when the package is loaded with "library(GillesCom)", so this is probably low priority for now.

andrechalom commented 8 years ago

The warnings were actually being caused by the NAMESPACE listing the imports in the wrong order (see #4), now that I am manually generating the namespace the warnings are gone.