哪里有关于使用 C++ 源代码创建 R 包的好教程? [英] where is a good tutorial on creating an R package with C++ source code?

查看:47
本文介绍了哪里有关于使用 C++ 源代码创建 R 包的好教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我开始查看配置脚本时,我不知所措.我不确定如何创建一个 R 包,它具有从 C/C++ 构建的多个功能,以便在 Windows 和 Windows 之间移植.Linux.我尝试修改现有软件包的内容没有结果.

I'm at a loss when I start looking at configure scripts. I'm not sure how to go about creating an R package which has several functions built from C/C++ in such a way that it's portable between Windows & Linux. My attempts to modify the guts of existing packages have been unfruitful.

任何帮助或链接将不胜感激.

Any help or links would be greatly appreciated.

更新:如果可能我想链接:提升,CUDA, &hwloc

Update: If possible I would like to link against: Boost, CUDA, & hwloc

但是,我意识到 Boost 将是一场噩梦hwloc 不会好很多.所以我只满足于CUDA.这就是为什么我深入研究并尝试修改一些现有的包以满足我的需要(rgl & rglpk).但我愿意在没有依赖关系的情况下从头开始构建.谢谢大家的建议!!

However, I realize that Boost will be a nightmare & hwloc won't be much better. So I'd settle for just CUDA. This was why I dove in the deep end and tried modifying some existing packages to suit my needs (rgl & rglpk). But I'm willing to start out without dependencies and build from the ground up. Thank you everyone for your suggestions!!

推荐答案

在用编译后的代码编写我的第一个包时,我也很迷茫.这里有一些提示,但可能还有更好的材料.

I was also quite lost when writing my first package with compiled code. Here are a few tips, but there is probably better material out there.

关于编写 R 包的主要部分是编写 R 扩展".这是一个非常完整的指南,但这也使得它有点难以阅读:http://cran.r-project.org/doc/manuals/R-exts.pdf

The main piece about writing R packages is "Writing R extensions". This is a very complete guide, but that also makes it abit hard to read through: http://cran.r-project.org/doc/manuals/R-exts.pdf

这是我在 google 上找到的一个小教程,我第一次使用它,包含如何使用 C 代码:http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf

Here is a small tutorial I found on google once which I used first, containing how to use C code: http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf

另一个关于 R 包的一般指南,但不包含 C 代码:http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf

Another guide on R packages in general, but not with C code: http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf

Rcpp 是一个非常有用的 C++ 代码包,但我还没有大量使用它(实际上是 3 天).它在包本身中有很多文档.

Rcpp is a very useful package for C++ code, but I haven't used it a lot yet (3 days in fact). It has a lot of documentation in the package itself.

这篇关于哪里有关于使用 C++ 源代码创建 R 包的好教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆