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++ code. I still feel intimidated by the complexity of Rcpp. Thank you! Yuanchao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130225/c0f440b0/attachment.html>
[Rcpp-devel] questions about Rcpp
4 messages · Yuanchao BO, Kevin Ushey, Dirk Eddelbuettel
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. I highly recommend taking the time to learn -- Rcpp is really less complex than it looks. It lowers the barriers to entry for C++ coding a very substantial amount for R programmers. Even if you have no background C++ experience, as long as you know the basic syntax you can learn C++ with / through Rcpp. Read through the vignettes, replicate and modify some of the code examples, see what works, see what breaks, and learn in that way. Hadley's guide at https://github.com/hadley/devtools/wiki/Rcpp is very excellent for going from 'no experience' to 'basic proficiency' as well. FWIW, I'm an Rcpp user rather than developer. I had basically no C++ background before delving into Rcpp, and Rcpp has been immensely useful for learning (and implementing!) some basic C++. -Kevin
On Mon, Feb 25, 2013 at 8:47 AM, Yuanchao BO <boyuanchao at gmail.com> wrote:
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++ code. I still feel intimidated by the complexity of Rcpp. Thank you! Yuanchao
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
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 to do things you cannot otherwise do. | Can I run the code in C++ by using Rcpp? Rcpp allows you to access C++ code from R in ways that are easier (we think) than the default. It does not create code. | Do I need to write extra codes to integrate R into C++? It depends. You sometimes need a little bit glue (but generally less than you would with C) and in many situations even the glue gets written. | I read some of the Rcpp tutorials and I am under an impression that most of the | Rcpp code is C++ code. I still feel intimidated by the complexity of Rcpp.? Yes, there is certainly no Rcpp without C++. It does not make C++ go away, it does try to make it easier to combine R with C++. Maybe have a look at the Rcpp-introduction vignette as well as at the Rcpp Gallery at http://gallery.rcpp.org . Hope this helps, Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
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 <edd at debian.org> wrote:
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 to do things you cannot otherwise do. | Can I run the code in C++ by using Rcpp? Rcpp allows you to access C++ code from R in ways that are easier (we think) than the default. It does not create code. | Do I need to write extra codes to integrate R into C++? It depends. You sometimes need a little bit glue (but generally less than you would with C) and in many situations even the glue gets written. | I read some of the Rcpp tutorials and I am under an impression that most of the | Rcpp code is C++ code. I still feel intimidated by the complexity of Rcpp. Yes, there is certainly no Rcpp without C++. It does not make C++ go away, it does try to make it easier to combine R with C++. Maybe have a look at the Rcpp-introduction vignette as well as at the Rcpp Gallery at http://gallery.rcpp.org . Hope this helps, Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130225/46ece528/attachment.html>