<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/"></div></div><div><a data-url="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/" data-counturl="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/" data-count="horizontal" data-text="Eclipse – an alternative to RStudio – part 2" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://datascienceplus.com/eclipse-an-alternative-to-rstudio-part-2/"> DataScience+</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In part one of this tutorial, I showed how to install R and LaTeX for Eclipse. Sadly, Eclipse doesn’t yet know where to find these resources, so we need to configure it appropriately. Statet provides a wizard to walk you through the setup, but I find the wizard difficult to follow. However, we can set up everything from the menus.</p>
<p>If you have used Eclipse for other projects, such as Java or Python, the setup for Statet will be familiar and intuitive. But if this is your first time on Eclipse, there’s a lot to take in. Basically, there are four steps to go through.</p>
<ul>
<li>Switch to the Statet perspective</li>
<li>Tell Eclipse how to use R. This requires two configurations.</li>
<li>Tell Eclipse how to use LaTeX</li>
<li>Tell Eclipse where to find your pdf viewer</li>
</ul>
<p>Let’s walk through each of these steps in detail.</p>
<h2>The Statet perspective</h2>
<p>Eclipse offers its users a way to organize programming projects by displaying the files and resources these projects require and by coordinating their use. A <em>perspective</em> is Eclipse speak for what you see after launch: the display of windows, folder trees and other features you might want for your work flow. You can change the displays during your session. Eclipse remembers what you did and launches a new session with the same perspective that you had upon shutdown.</p>
<p>The previous tutorial ended with a clean install of Eclipse, to which we had just installed Statet. Upon relaunch, we get the default Java perspective. You can see the word Java in highlight at the upper right corner. To get the Statet perspective, select Window -> Perspective -> Open perspective -> Other.</p>
<p><a title="" data-rel="lightbox-0" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008.png 1366w" alt="Changing perspective" class="wp-image-4295" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00008-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>This gives you the list of all installed perspectives. Select Statet from the list.</p>
<p><a title="" data-rel="lightbox-1" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009.png 1366w" alt="Kazam_screenshot_00009" class="wp-image-4296" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00009-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Done! Now you should see the default layout of the Statet perspective. Note that <strong>Statet</strong> appears in highlight to the right of the Java button. We can switch between these perspectives by clicking their respective buttons. Alternatively, you can go through the drop down menu as before, selecting Window and Perspective.</p>
<p><a title="" data-rel="lightbox-2" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010.png 1366w" alt="The default Statet perspective." class="wp-image-4298" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00010-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<h2>A quick tour of the Statet perspective</h2>
<p>I’ll talk more about working with this perspective in a later post, but for now, let’s take a quick look at what you get.</p>
<ul>
<li>A menu bar with the usual items. We have already used <strong>Window</strong> and <strong>Help</strong>.</li>
<li>An icon toolbar with shortcuts to useful items from the menu bar.I usually work with the icons.</li>
<li>Upper left: the project manager. When we create projects and add project folders, they will show up here.</li>
<li>Top centre: a blank window for <em>Editors.</em> To Eclipse, anything that creates a document or displays a document is an <em>Editor.</em> This is where you will write your Sweave documents. It’s also where the compiled pdf’s will appear.</li>
<li>Bottom centre: a blank window for the R console.</li>
<li>Upper right: Outline. This panel provides an outline of your LaTeX/Sweave document. Section headings and sub-headings appear as indents. The outline also references any R chunks you may have in your document. </li>
<li>Lower left: other options. Click on the tabs for the object browser, R help files and other useful information. The Object browser gives you the output from the R <code>search()</code> function.</li>
</ul>
<p>None of these goodies are actually available to us yet, because we need to set up the Run configurations for R and LaTeX.</p>
<h2>The R run configuration</h2>
<p>Let’s try something that doesn’t work! Select Run -> Run as, or click on the context menu next to the green menu button.</p>
<p><a title="" data-rel="lightbox-3" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011.png 1366w" alt="Kazam_screenshot_00011" class="wp-image-4304" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00011-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Typically, the green button will run the previous configuration, but since we have no launch history, nothing happens! We need to create a Run configuration first.</p>
<p>Select <strong>Run Configurations</strong> to get the configuration screen. Select <strong>R Console</strong> and click the document icon at the upper left to get a template for the new configuration.</p>
<p><a title="" data-rel="lightbox-4" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012.png 1366w" alt="Kazam_screenshot_00012" class="wp-image-4305" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00012-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Note the error message along the top of the screen: <em>The R environment preferences of the Workspace are invalid.</em> They are invalid because we haven’t set them up yet. We’ll get to that later.</p>
<p><a title="" data-rel="lightbox-5" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013.png 1366w" alt="Kazam_screenshot_00013" class="wp-image-4306" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00013-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Give the configuration a useful name. I’m running R 3.3.0, <em>Essentially Educational</em>, so I name the configuration <em>Educational</em>. Then enter the working directory. The plus sign to the right of the form opens to allow you to browse to the folder of your choice.</p>
<p>You could configure a separate configuration for every R project and direct R to launch from the project folder. I typically use the Eclipse workspace here, and change my working directory from the R console as needed.</p>
<p><a title="" data-rel="lightbox-6" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014.png 1366w" alt="Kazam_screenshot_00014" class="wp-image-4307" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00014-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Click <strong>Apply</strong> to save the changes and select the R Config tab. This is where we tell Eclipse which version of R we want to use. Currently, we have no configurations, so let’s add one.</p>
<h2>The R configuration screen</h2>
<p>Click on <strong>Select configuration</strong> and then click on <strong>Configure</strong>.</p>
<p><a title="" data-rel="lightbox-7" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015.png 1366w" alt="Kazam_screenshot_00015" class="wp-image-4309" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00015-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Select <strong>R Environment</strong> and click <strong>Add</strong>.</p>
<p><a title="" data-rel="lightbox-8" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016.png 1366w" alt="Kazam_screenshot_00016" class="wp-image-4310" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00016-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>If you installed R using the default settings, this screen will typically complete itself with little prompting from you.</p>
<ul>
<li>Give the environment a name. </li>
<li>Insert the location of R home. The context menu item <em>try find automatically</em> usually works. If it fails, open an R console (outside of Eclipse!) and run <code>R.home()</code>. This will give you the absolute path to the top level directory of your R installation. Use this value.</li>
</ul>
<p><a title="" data-rel="lightbox-9" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017.png 1366w" alt="Kazam_screenshot_00017" class="wp-image-4312" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00017-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Now click on <em>Detect Default Properties/Settings</em>. Click <strong>OK</strong> to complete the screen.</p>
<p><a title="" data-rel="lightbox-10" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018.png 1366w" alt="Kazam_screenshot_00018" class="wp-image-4313" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00018-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Eclipse can build an R index to enable access to package help files. There are several options here from the drop down menu. I use <em>Check and update automatically</em>. And finally, don’t forget to click <strong>Apply.</strong></p>
<p><a title="" data-rel="lightbox-11" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019.png 1366w" alt="Kazam_screenshot_00019" class="wp-image-4314" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00019-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<h3>Back to the Run Configuration template</h3>
<p>The previous step returns you to the Run Configuration template. But this time, we can supply an R environment. With only one version of R on my system, I select the default. If you are running several versions of R, you can create a configuration for each and select the one you need for the current Run configuration. Complete the screen and click <strong>Apply.</strong></p>
<p><a title="" data-rel="lightbox-12" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020.png 1366w" alt="Kazam_screenshot_00020" class="wp-image-4315" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00020-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<h3>Finishg up</h3>
<p>The default settings from the remaining tabs typically work fine. However, if you need to specify additional R environment variables, a specific version of Java or working directories, you can do this here. For me, I only need to make a few adjustments to the <strong>Common</strong> tab.</p>
<p><a title="" data-rel="lightbox-13" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021.png 1366w" alt="Kazam_screenshot_00021" class="wp-image-4318" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00021-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>I select <strong>Debug</strong> and <strong>Run</strong>. This lets my configuration appear on the menus of the green Run button and of the bug shaped Debug button.</p>
<p>You may also want to adjust the coding. The template defaults to the default encoding of your operating system. On my Linux box, this is UTF-8. Windows users may have a different default.</p>
<h3> Encoding for Windows users in bilingual workplaces </h3>
<p>If you are running Windows as an English speaker, your default will be cp1250. If you need to write a document in a different language, cp1250 may not play well with laTeX’s babel package. If you find that your pdf’s look weird, check the encoding under the <strong>Common</strong> tab and switch to utf-8, or whatever you need.</p>
<h3>And finally …</h3>
<p>Click <strong>Apply</strong> one last time to save the configuration. Now click <strong>Close</strong> to leave the template, or <strong>Run</strong> to test your work. An R console should launch in the console window of Eclipse.</p>
<p>The first time, you will have to wait a few moments before you get the R prompt while the system indexes your help files. I choose the global index option. Subsequent launches will go a lot faster.</p>
<p><a title="" data-rel="lightbox-14" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022.png 1366w" alt="Kazam_screenshot_00022" class="wp-image-4350" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00022-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<h2>Configure LaTeX</h2>
<p>If you followed the previous steps, you should now be able to run an R console from within Eclipse. You can also create R scripts, save and run them, as I show in a different tutorial. But the power of Statet lies in allowing you to embed R commands in a LaTeX document, thus combining the analysis and its documentation in one place. To get this up and running, Eclipse needs to know where to find LaTeX and how to run it.</p>
<p>After what you’ve been through with configuring R, configuring LaTeX should be straightforward. Let’s walk through the details.</p>
<p>Select <strong>Run -> External Tools -> External tools configuration</strong> from the menu, or select the context menu next to the green arrow with the briefcase and <strong>External tools configuration</strong>.</p>
<p><a title="" data-rel="lightbox-15" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023.png 1366w" alt="Kazam_screenshot_00023" class="wp-image-4351" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00023-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>The external tools configuration menu is similar to the Run configuration menu that we saw before. Highlight <strong>Sweave document</strong> and click on the icon for a new launch configuration.</p>
<p><a title="" data-rel="lightbox-16" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024.png 1366w" alt="Kazam_screenshot_00024" class="wp-image-4352" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00024-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>The configuration menu appears. Give the configuration a name. Most of the defaults work fine as they are, but you probably want change the build option. Click on the tab marked <strong>LaTeX</strong>.</p>
<p><a title="" data-rel="lightbox-17" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025.png 1366w" alt="Kazam_screenshot_00025" class="wp-image-4353" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00025-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>This screen lets you control the LaTeX build. The default creates a dvi file, which is a bit old fashioned. I prefer to use <em>pdflatex</em> to obtain my document as a pdf.</p>
<p>Select the menu arrow next to <em>dvi</em> and select <em>pdflatex</em> from the menu.</p>
<p><a title="" data-rel="lightbox-18" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027.png 1366w" alt="Kazam_screenshot_00027" class="wp-image-4355" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00027-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>And don’t forget to click <strong>Apply</strong> to save the change.</p>
<p><a title="" data-rel="lightbox-19" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028.png 1366w" alt="Kazam_screenshot_00028" class="wp-image-4356" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00028-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Select tab <strong>Common</strong> and select <strong>External tools</strong>. This causes the Sweave configuration to appear under the External Tools icon on the toolbar. Check that the encoding suits the language you plan to use. Finally, click <strong>Apply.</strong></p>
<p><a title="" data-rel="lightbox-20" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029.png 1366w" alt="Kazam_screenshot_00029" class="wp-image-4357" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00029-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Close the menu. Eclipse is now configured for Sweave.</p>
<h3>Setting the PDF viewer</h3>
<p>When Sweave compiles your document, it will attempt to display the PDF in the editor window using the default Eclipse viewer. Current versions of Eclipse do not specify the default PDf reader, so we need to do that now.</p>
<p>Select <strong>Window -> Preferences</strong> to get the preferences menu. Select <strong>Editors -> File associations</strong>. Click <strong>Add</strong>.</p>
<p><a title="" data-rel="lightbox-21" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030.png 1366w" alt="Kazam_screenshot_00030" class="wp-image-4358" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00030-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>Enter <code>*.pdf</code> in the form. Click <strong>OK</strong></p>
<p><a title="" data-rel="lightbox-22" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031.png 1366w" alt="Kazam_screenshot_00031" class="wp-image-4359" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Kazam_screenshot_00031-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<p>We have just added a new file extension. Now, we need to add an associated viewer. Click <strong>Add</strong> next to the window of <em>Associated Editors</em>. A list will appear of applications internal to Eclipse, followed by external applications. I am running Kubuntu, so I select Okular. On a Windows system, you could select the Adobe Acrobat Reader, or whatever you have installed. It should appear on the list.</p>
<p><a title="" data-rel="lightbox-23" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Using-okular.png"><img sizes="(max-width: 490px) 100vw, 490px" srcset="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Using-okular-490x275.png?resize=456%2C256 490w, http://datascienceplus.com/wp-content/uploads/2016/07/Using-okular-768x432.png 768w, http://datascienceplus.com/wp-content/uploads/2016/07/Using-okular-1024x576.png 1024w, http://datascienceplus.com/wp-content/uploads/2016/07/Using-okular-600x337.png 600w, http://datascienceplus.com/wp-content/uploads/2016/07/Using-okular-300x169.png 300w, http://datascienceplus.com/wp-content/uploads/2016/07/Using-okular.png 1366w" alt="Using okular" class="wp-image-4360" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/07/Using-okular-490x275.png?resize=456%2C256" data-recalc-dims="1"></a></p>
<h2>Troubleshooting</h2>
<p>Congratulations! Grab a coffee and enjoy using R and Sweave in Eclipse. If you followed all the instructions as indicated, you should be able to compose a document in LaTeX with R code chunks and compile your work to a PDf document.</p>
<p><b>But what if it fails?</b></p>
<ul>
<li>Double check the previous steps.</li>
<li>Ensure that you clicked <strong>Apply</strong> on every screen that has an <strong>Apply</strong> button. These are a bit random, so make sure you didn’t miss one of them.</li>
<li>Fails often occur in completing the R configuration menu. In particular, make sure that you clicked <em>Detect default properties/settings</em> from the R-config menu. </li>
</ul>
<ul></ul>
<p><strong>
<p>Related Post</p>
<p>
<ol>
<li><a title="Permanent Link toEclipse – an alternative to RStudio – part 1" target="_blank" rel="bookmark" href="http://datascienceplus.com/eclipse-an-alternative-to-rstudio-part-1/">Eclipse – an alternative to RStudio – part 1</a></li>
<li><a title="Permanent Link toHow to use R for matching samples (propensity score)" target="_blank" rel="bookmark" href="http://datascienceplus.com/how-to-use-r-for-matching-samples-propensity-score/">How to use R for matching samples (propensity score)</a></li>
<li><a title="Permanent Link toR for Publication by Page Piccinini: Lesson 1 – R Basics" target="_blank" rel="bookmark" href="http://datascienceplus.com/r-for-publication-by-page-piccinini-lesson-1-r-basics/">R for Publication by Page Piccinini: Lesson 1 – R Basics</a></li>
<li><a title="Permanent Link toR for Publication by Page Piccinini: Lesson 0 – Introduction and Set-up" target="_blank" rel="bookmark" href="http://datascienceplus.com/r-for-publication-by-page-piccinini-lesson-0-introduction-and-set-up/">R for Publication by Page Piccinini: Lesson 0 – Introduction and Set-up</a></li>
<li><a title="Permanent Link toHow to export Regression results from R to MS Word" target="_blank" rel="bookmark" href="http://datascienceplus.com/how-to-export-regression-results-from-r-to-ms-word/">How to export Regression results from R to MS Word</a></li>
</ol></strong>
<div>
<a target="_blank" href="https://feeds.feedburner.com/~ff/datascienceplus?a=CbyKinsprlY:WgA4U7x1pVQ:D7DqB2pKExk"><img src="https://feeds.feedburner.com/~ff/datascienceplus?i=CbyKinsprlY:WgA4U7x1pVQ:D7DqB2pKExk" border="0"></a> <a target="_blank" href="https://feeds.feedburner.com/~ff/datascienceplus?a=CbyKinsprlY:WgA4U7x1pVQ:qj6IDK7rITs"><img src="https://feeds.feedburner.com/~ff/datascienceplus?d=qj6IDK7rITs" border="0"></a> <a target="_blank" href="https://feeds.feedburner.com/~ff/datascienceplus?a=CbyKinsprlY:WgA4U7x1pVQ:yIl2AUoC8zA"><img src="https://feeds.feedburner.com/~ff/datascienceplus?d=yIl2AUoC8zA" border="0"></a>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/"></div></div><div><a data-url="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/" data-counturl="https://www.r-bloggers.com/eclipse-an-alternative-to-rstudio-part-2/" data-count="vertical" data-text="Eclipse – an alternative to RStudio – part 2" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://datascienceplus.com/eclipse-an-alternative-to-rstudio-part-2/"> DataScience+</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/mWmKLnuYw90"></a></div>