且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows上设置Eclipse + StatET + Rcpp

更新时间:2023-11-13 10:50:40

对于此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.