如何在Windows上设置Eclipse + StatET + Rcpp [英] How to set up Eclipse + StatET + Rcpp on Windows

查看:153
本文介绍了如何在Windows上设置Eclipse + StatET + Rcpp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我知道可以使用Rcpp用C ++创建R包时,我对此感到很兴奋,并渴望了解它的开发环境.多亏了 Fell Stat Blog ,我可以使用带有StatET的Eclipse快速建立良好的环境R的插件,以便在Windows上使用Rcpp和RInside(用于将R嵌入到C ++应用程序中的另一个软件包).

When I came to know that I can create a R package with C++ using Rcpp, I was excited about it and eager to know development environment for it. And thanks to Fell Stat Blog, I could quickly establish a great environment using Eclipse with StatET, its plugin for R, to use Rcpp and RInside (another package for embedding R into your C++ application) on Windows.

但是,由于该博客是基于OS X的,因此需要进行一些试验和测试.错误(几乎是放弃)以适应Windows的需要-我花了6个小时的闲暇时间.例如,您需要安装Rtools以便能够使用R CMD语句和Miktex将Rd文件转换为pdf文件来编译C/C ++.此外,构建设置与OS X不同.

Since the blog was, however, based on OS X, several things required trial & error (& almost give-up) to adjust for Windows - it took me 6 hours of my leisure time. For example, you need to install Rtools to be able to compile C/C++ using R CMD statements and Miktex to convert your Rd files to pdf file. In addition, build settings are different from OS X.

为了使其他人免于可能的审判&我经历的错误时期,我在Eclipse + StatET + Rcpp在Windows上制作了这个wiki.随时发表评论或其他答案.否则,请享受这个强大的开放源代码环境,以进行分析软件开发.

In order to save others from possible trial & error period I've experienced, I made this wiki on Eclipse + StatET + Rcpp on Windows. Feel free to make comment or another answer. Otherwise, enjoy this great open source environment for analytical software development you can get.

更新(2016年末):几年前,我将R的IDE从Eclipse更改为RStudio,并向使用R和Rcpp的每个人推荐它.

UPDATE (late 2016): Few years ago, I changed IDE for R from Eclipse to RStudio and I recommend it for everyone using R and Rcpp.

推荐答案

对于此Wiki,我将基于最新版本的R 2.15.1继续我的演讲,这是您需要遵循的步骤列表.

For this wiki, I will proceed my talk based on the latest version of R, R 2.15.1 and this is the list of steps you need to follow.

  1. 如果您已经在Windows系统中安装了 R ,请确保其路径中不包含空格,例如"C:\ Program Files \ R \ R-2.15.1".如果是这样,除了将R系统重新安装到诸如"C:\ R \ R-2.15.1"之类的目录之外,您什么也不能做.如果不这样做, Rcpp或RInside将无法在您的系统上运行.

  1. If you have already installed R in your Windows system, make sure its path does not include space such as "C:\Program Files\R\R-2.15.1". If so, there is nothing you can do but reinstall your R system to a directory such as "C:\R\R-2.15.1". If you don't do that, Rcpp or RInside will not work on your system.

安装 Rtools(在这种情况下为Rtools2.15.1)该安装程序包括运行R CMD和相关内容的基本工具以及gcc编译器.我将其安装到"C:\ Rtools"

Install Rtools (Rtools2.15.1 in this case) This installer includes basic tools to run R CMD and related things and gcc compiler. I installed this into "C:\Rtools"

(可选),您可以安装MikTex以在执行R CMD检查时从Rd文件自动生成pdf文件.确保<Miktext installation directory>\miktex\bin在系统路径中.

(Optional) You can install MikTex to automatically generate pdf file from your Rd files when R CMD check executed. Make sure <Miktext installation directory>\miktex\bin is in your system path.

在系统路径中包括以下目录.这个很重要.否则,它们中的大多数将无法正常工作.

Include following directories into your system path. This is important. Otherwise, most of them here will not work.

C:\Rtools\bin; C:\Rtools\gcc-4.6.3\bin; C:\R\R-2.15.1\bin\i386;

C:\Rtools\bin; C:\Rtools\gcc-4.6.3\bin; C:\R\R-2.15.1\bin\i386;

如果您还没有Eclipse,请请与CDT一起安装您已经拥有它,请确保已安装CDT插件.

If you don't have Eclipse yet, please install it with CDT If you have it already, make sure you have installed CDT plugin.

现在该安装 R的Eclipse插件StatET .网站建议,我使用http://download.walware.de/eclipse-3.8进行安装.之后,运行R Windows并安装Rj install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1") 之后,完成StatET的安装.在Eclipse中,请遵循StatET的备忘单以熟悉环境.特别是,创建R环境,R控制台配置,R CMD检查,构建,安装的外部配置,以便您可以在Eclipse中运行R及其CMD.

Now it's time to install an Eclipse plugin for R, StatET As the web site suggested, I used http://download.walware.de/eclipse-3.8 to install it. After that, ran R windows and installed Rj install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1") After that, you are done with installing StatET. In Eclipse, follow Cheatsheet of StatET to make yourself familiar with the environment. Especially, create R environment, R console configuration, external configuration for R CMD check, build, install so you can run R and its CMD in Eclipse.

是时候安装Rcpp和RInside.按照Fell Stat的建议,我在Eclipse的R控制台中使用了以下命令. install.packages(c("Rcpp","RInside"),type="source")这将从互联网上获取Rcpp和RInside的源文件并在安装它们之前对其进行编译.如果您在此处收到任何错误消息,那么现在是检查您是否遵循我上面描述的所有步骤的好时机.就我而言,当我没有正确设置系统路径或R路径包含空格时,我得到了一些东西.

It's time to install Rcpp and RInside. As Fell Stat recommended, I used following in R console in Eclipse to do that. install.packages(c("Rcpp","RInside"),type="source") This will get source of Rcpp and RInside from internet and compile them before installing them. If you get any error message here, it's good time to check you followed everything I described above. In my case, I got some when I didn't set system path right or when my R path included space.

现在是时候使用测试项目来检查环境了.为此,建议您阅读 Fell Stat博客的第4、5、6、7步 .我建议的一件事是,当您创建示例项目时,请使用

Now it's time to examine the environment with a test project. For this, I recommend you read step 4, 5, 6, 7 of Fell Stat Blog. One thing I recommend is that when you create a sample project, use

Rcpp.package.skeleton("MyCppPackage", module=TRUE)

那样,您将通过Rcpp模块体验Rcpp的强大功能.

That way, you would experience power of Rcpp with Rcpp modules.

正如我所说,在#7中,某些设置与Windows上的OS X不同.我将在此处在图像上显示我的设置.在这里,我没有为RInside设置目录,但是我希望您可以从Rcpp设置中轻松地弄清楚这一点.

As I said, in #7, some settings are different from OS X on Windows. I will just display my setting here on images. Here, I didn't set directories for RInside, but I hope you can easily figure this out from Rcpp setup.

希望这会有所帮助.享受.

Hope this helps. Enjoy.

这篇关于如何在Windows上设置Eclipse + StatET + Rcpp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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