Re: [Rcpp-devel] Working with indicators in Armadillo

2013-02-25 Thread Conrad S
On Sun, Feb 24, 2013 at 6:33 AM, Simon Zehnder wrote: > 1 arma::mat repS = arma::repmat(S, 1, K); > 2 arma::mat compM = arma::ones(S.n_rows, K); > 3 arma::rowvec par_post(K); > 4 > 5 for(unsigned int k = 0; k < K; ++k) { > 6 compM.col(k) = compM.col(k) * (k + 1); > 7 }

Re: [Rcpp-devel] ==> Rcpp::compileAttributes()

2013-02-25 Thread JJ Allaire
Hi Aileen, If you update RStudio to the latest version (v0.97.318) then you shouldn't see this error any longer. J.J. On Mon, Feb 25, 2013 at 9:02 PM, Aileen Lin wrote: > Hi there, > > I created a r project in r studio. This project has some cpp files and r > files. Thereafter, I used devtools:

[Rcpp-devel] ==> Rcpp::compileAttributes()

2013-02-25 Thread Aileen Lin
Hi there, I created a r project in r studio. This project has some cpp files and r files. Thereafter, I used devtools::document(). Everything was fine. Now I click 'Build & Reload' in the top right panel. I have this error message: ==> Rcpp::compileAttributes() Error in eval(expr, envir, enclos)

Re: [Rcpp-devel] questions about Rcpp

2013-02-25 Thread Yuanchao BO
Hi Dirk and Kevin, Thanks very much for your responses! It seems Rcpp is an intermediate step between C++ and R. I will take a look at the examples that you mentioned. Regards, Yuanchao On Mon, Feb 25, 2013 at 1:38 PM, Dirk Eddelbuettel wrote: > > Hi Yuanchao, > > On 25 February 2013 at 11:4

Re: [Rcpp-devel] questions about Rcpp

2013-02-25 Thread Dirk Eddelbuettel
Hi Yuanchao, On 25 February 2013 at 11:47, Yuanchao BO wrote: | I have some questions about Rcpp. I have a complicated R code. Rcpp does not change or simplify your R code. If anything it may make it more complicated as you now have R and C++. But it may also make it a lot faster, or allow you

Re: [Rcpp-devel] questions about Rcpp

2013-02-25 Thread Kevin Ushey
Hi Yuanchao, Rcpp is a tool for transferring R objects between R and C++ code: essentially, you can write functions / modules in C++ that can operate on, generate, and modify R objects, which are then callable from within R. So yes, you're going to have to write some C++ code to make use of Rcpp.

[Rcpp-devel] questions about Rcpp

2013-02-25 Thread Yuanchao BO
Hi all, I am a third year PhD student. I have some questions about Rcpp. I have a complicated R code. Can I run the code in C++ by using Rcpp? Do I need to write extra codes to integrate R into C++? I read some of the Rcpp tutorials and I am under an impression that most of the Rcpp code is C++