Hi Jules,
On 9 July 2013 at 22:16, Jules Archer wrote:
| Hi,
|
| I've been trying to integrate the mathGL plotting library into R with Rcpp,
| with the ultimate goal of rendering in the browser. So far, I've been
| successful with creating simple plotting test functions, compile with
sourceCpp
Hi,
I've been trying to integrate the mathGL plotting library into R with Rcpp,
with the ultimate goal of rendering in the browser. So far, I've been
successful with creating simple plotting test functions, compile with
sourceCpp("myplotter.cpp") and output *.png and *.json files for browser 3
Sorry, my bad, the method to use is reserve, not resize. Resize will only
extend a vector.
The Code Project article on the vector container does use function pointers,
however, there are better ways to do this, particularly if you avoid the MFC
stuff as if it were the plague bacillus and use st
My $0.02.
Dirk is right - pick something and stick with it, but avoid the raw pointers,
especially if your experience is limited. It's much easier to learn the smart
pointers std::shared_ptr and std::unique_ptr, or their boost equivalents,
rather than deal with raw pointers in new code.
htt
This has already been answered by Dirk and Bill. Although the OPs example can,
of course, be reproduced in R, sans Rcpp. I use rep(0.1,9) in place of
rep(0.1,10).
We can use Rcpp to see various differences explicitly:
> options(digits=22)
> vx=rep(0.1,9)
> vx[1]+vx[2]+vx[3]+vx[4]+vx[5]+vx[6]+v