{"id":194,"date":"2010-04-28T16:56:18","date_gmt":"2010-04-28T20:56:18","guid":{"rendered":"http:\/\/lukemiller.org\/?p=194"},"modified":"2011-02-12T12:05:25","modified_gmt":"2011-02-12T17:05:25","slug":"eclipse-and-statet-a-nice-working-environment-for-r","status":"publish","type":"post","link":"https:\/\/lukemiller.org\/index.php\/2010\/04\/eclipse-and-statet-a-nice-working-environment-for-r\/","title":{"rendered":"Eclipse and StatET &#8211; a working environment for R"},"content":{"rendered":"<p>In the endless search to find an interface for the<a href=\"http:\/\/www.r-project.org\/\" target=\"_blank\"> R statistics package<\/a> that recreates the features of my favorite Matlab development environment, I finally ran across the Eclipse and StatET combination. The <a href=\"http:\/\/www.eclipse.org\/downloads\/\" target=\"_blank\">Eclipse<\/a> project produces the program that acts as the integrated development environment (also useful for Java development, php development, perl scripting etc.). To integrate your R installation into this development environment, you use the StatET plug-in for Eclipse, available at <a href=\"http:\/\/www.walware.de\/?page=\/it\/statet\/\">http:\/\/www.walware.de\/?page=\/it\/statet\/<\/a>. The result looks like the picture below:<\/p>\n<figure id=\"attachment_195\" aria-describedby=\"caption-attachment-195\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Eclipse_example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-195   \" title=\"Eclipse example\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Eclipse_example-300x231.png\" alt=\"\" width=\"300\" height=\"231\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Eclipse_example-300x231.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Eclipse_example-1024x790.png 1024w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Eclipse_example.png 1108w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-195\" class=\"wp-caption-text\">The Eclipse\/StatET development environment for R. There aren&#39;t normally crudely drawn red circles on it. <\/figcaption><\/figure>\n<p>The upshot of this is that you get a development environment that has the normal R console that you&#8217;re familiar with, plus a window to do your script file editing (with colored syntax highlighting and syntax checking), and a list of the environmental variables (i.e. your data frames, arrays, lists etc) that exist in the current R session in the Object Browser.<\/p>\n<p>Here&#8217;s how you get it set up and running (on Windows 7 in this case, there are also OS X and Linux flavors available):<\/p>\n<p>The first thing to do is fire up your normal R installation and download the rJava package, which is available on the R servers like every other package. Once you&#8217;ve done this, you can close R. If you&#8217;ve used R for more than five minutes, you&#8217;ve probably downloaded packages before, so I&#8217;ll skip the details.<\/p>\n<p>Download the Eclipse package from <a href=\"http:\/\/www.eclipse.org\/downloads\">http:\/\/www.eclipse.org\/downloads<\/a> I used the &#8220;Eclipse IDE for Java EE Developers,&#8221; package (about 190MB). This version includes tools for doing other stuff like html and php editing.<\/p>\n<p>Unzip the Eclipse files, open the folder, and run eclipse.exe.<\/p>\n<p>When you arrive at the Eclipse intro screen, choose the icon that takes you to the &#8220;Workbench&#8221;.<\/p>\n<figure id=\"attachment_224\" aria-describedby=\"caption-attachment-224\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/initial_screen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-224\" title=\"Initial screen\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/initial_screen-300x224.png\" alt=\"\" width=\"300\" height=\"224\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/initial_screen-300x224.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/initial_screen.png 1023w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-224\" class=\"wp-caption-text\">The splash screen for Eclipse. Click on the &quot;Workbench&quot; icon in the upper right to continue.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>At the Workbench, Go to the Help Menu and choose Install New Software.<\/p>\n<figure id=\"attachment_196\" aria-describedby=\"caption-attachment-196\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Install_new_software_menu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-196   \" title=\"Install new software\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Install_new_software_menu-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Install_new_software_menu-300x225.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Install_new_software_menu.png 1018w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-196\" class=\"wp-caption-text\">Go to Help&gt;Install new software.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>On the new window,\u00a0 hit the &#8220;Add&#8221; button on the right.<\/p>\n<figure id=\"attachment_197\" aria-describedby=\"caption-attachment-197\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-197 \" title=\"Add the StatET site\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site-300x282.png\" alt=\"\" width=\"300\" height=\"282\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site-300x282.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-197\" class=\"wp-caption-text\">Add the StatET site.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>In the window that appears, paste in the Walware site address (see their install instructions <a href=\"http:\/\/www.walware.de\/?page=\/it\/statet\/\" target=\"_blank\">here<\/a>)\u00a0 in the Location field. Leave the Name field blank. Hit OK.<\/p>\n<figure id=\"attachment_198\" aria-describedby=\"caption-attachment-198\" style=\"width: 486px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-198 \" title=\"Enter the StatET site address\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site2.png\" alt=\"\" width=\"486\" height=\"184\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site2.png 486w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site2-300x113.png 300w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><\/a><figcaption id=\"caption-attachment-198\" class=\"wp-caption-text\">Enter the StatET site address.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Back on the Install New Software window, click on the &#8220;Work with:&#8221; menu and choose the Walware site from the list of available sites. A set of objects should appear in the lower window. Check the box next to each of the items, and then hit Next. Go through the install windows, agree to all the licenses and what not, and restart Eclipse when it prompts you.<\/p>\n<figure id=\"attachment_199\" aria-describedby=\"caption-attachment-199\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-199\" title=\"Add_statet_site3\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site3-300x282.png\" alt=\"\" width=\"300\" height=\"282\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site3-300x282.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_statet_site3.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-199\" class=\"wp-caption-text\">Select each item in the list to install.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Now, you still can&#8217;t do anything with R until you create a new project. Go to File&gt;New&gt;Project.<\/p>\n<figure id=\"attachment_200\" aria-describedby=\"caption-attachment-200\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-200 \" title=\"Create a new project\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project-300x233.png\" alt=\"\" width=\"300\" height=\"233\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project-300x233.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project.png 522w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-200\" class=\"wp-caption-text\">Create a new project.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>In the New Project window, click on the StatET folder, and choose R-Project, then hit Next.<\/p>\n<figure id=\"attachment_201\" aria-describedby=\"caption-attachment-201\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project_select_R-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-201 \" title=\"Select StatET\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project_select_R-project-300x291.png\" alt=\"\" width=\"300\" height=\"291\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project_select_R-project-300x291.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Create_new_project_select_R-project.png 513w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-201\" class=\"wp-caption-text\">Select the StatET folder and click on the R-Project item.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Give your project a name and choose a location for this project file to live (the default location may be fine, or you may want to point it at the directory where you R data live). Hit Finish. You will get a message that this project is &#8220;associated with the StatET perspective&#8221;. Tell it that you want this to be the default and hit OK.<br \/>\nNext we&#8217;ll set it up so that an R console runs within this Eclipse environment.<\/p>\n<p>Go to Window&gt;Preferences. In the window that opens, click on the StatET folder, then on Run\/Debug and R Environments. In the new display on the right, click the Add button.<\/p>\n<figure id=\"attachment_202\" aria-describedby=\"caption-attachment-202\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Set_up_R_environment.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-202 \" title=\"Setting up the R environment\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Set_up_R_environment-300x260.png\" alt=\"\" width=\"300\" height=\"260\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Set_up_R_environment-300x260.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Set_up_R_environment.png 635w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-202\" class=\"wp-caption-text\">Setting up the R environment.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>In the window that appears &#8220;Add R Environment Configuration&#8221;, give the R environment some name. In the location field, click on the + sign on the right side and choose Browse Filesystem. Go to the folder where you current R installation lives. In my case, it&#8217;s the R-2.10.1 folder that contains all the R system files.<\/p>\n<figure id=\"attachment_203\" aria-describedby=\"caption-attachment-203\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_R_environment.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-203 \" title=\"Add_R_environment\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_R_environment-300x132.png\" alt=\"\" width=\"300\" height=\"132\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_R_environment-300x132.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_R_environment.png 862w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-203\" class=\"wp-caption-text\">Tell Eclipse where your R installation lives.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<figure id=\"attachment_204\" aria-describedby=\"caption-attachment-204\" style=\"width: 364px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Select_Location_R_Home.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-204 \" title=\"Select_Location_R_Home\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Select_Location_R_Home.png\" alt=\"\" width=\"364\" height=\"414\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Select_Location_R_Home.png 364w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Select_Location_R_Home-263x300.png 263w\" sizes=\"auto, (max-width: 364px) 100vw, 364px\" \/><\/a><figcaption id=\"caption-attachment-204\" class=\"wp-caption-text\">My R installation lives in the R-2.10.1 folder.<\/figcaption><\/figure>\n<p style=\"text-align: center;\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Add_R_environment.png\"><\/a><\/p>\n<p>Back on the &#8220;Add R Environment Configuration&#8221; window, hit the &#8220;Detect Default Properties\/Settings, and then hit OK. Hit Apply near the bottom of the main preferences window.<\/p>\n<p>On the left side of the Preferences window, click on the R Interaction item, just below the R Environments item we just worked with. Choose &#8220;New Console inside Eclipse&#8221;.<br \/>\nHit OK to exit the Preferences window.<\/p>\n<figure id=\"attachment_205\" aria-describedby=\"caption-attachment-205\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_interaction.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-205 \" title=\"R_interaction\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_interaction-300x262.png\" alt=\"\" width=\"300\" height=\"262\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_interaction-300x262.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_interaction.png 633w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-205\" class=\"wp-caption-text\">Set this to use a New Console inside Eclipse, leave the other items on their default values.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Back on the main Eclipse workbench, we&#8217;ll now fire up an R Console. Go to Run&gt;Run Configurations. Click on the R Console item on the left, then click on the &#8216;New&#8217; icon above it (looks like a piece of paper with a plus sign in the upper right). This will open a new display on the right. (Incidentally, when you start a new Eclipse session in the future, you can launch the R console by going to the Run&gt;Run History menu and just choosing the name of the R console you set up previously).<\/p>\n<figure id=\"attachment_206\" aria-describedby=\"caption-attachment-206\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-206\" title=\"Run_configuration\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration-300x205.png\" alt=\"\" width=\"300\" height=\"205\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration-300x205.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration.png 808w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-206\" class=\"wp-caption-text\">Name your run configuration something useful, leave Launch Type as RJ (RMI\/JRI), and set a working directory.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">First name your new configuration something besides &#8220;New_configuration&#8221; in the Name field. On the Main Tab, leave the Launch Type set as RJ (RMI\/JRI). In the Working Directory field, navigate to your normal R working directory. In the Options\/Arguments field, you could enter some startup commands that you would like to be run every time you fire up this R console. Maybe that would include loading a library or running a source file.<\/p>\n<p>Now click on the R Console tab, where you have a few further options. &#8220;Pin initial console automatically&#8221; is fine to use. You can tell Eclipse to keep track of your history and save a transcript of the session as well in the second field. And down at the very bottom, there is a section called &#8220;Object DB&#8221;. Make sure this is checked (Enable) and that &#8220;Refresh DB automatically&#8221; is checked. This Object DB is the function that will list all of your variables that are in memory while you&#8217;re working in R, so you&#8217;ll want it to be functional.<\/p>\n<figure id=\"attachment_207\" aria-describedby=\"caption-attachment-207\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-207\" title=\"Run_configuration_2\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration_2-300x265.png\" alt=\"\" width=\"300\" height=\"265\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration_2-300x265.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Run_configuration_2.png 803w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-207\" class=\"wp-caption-text\">Make sure the Object DB check boxes are checked. <\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Click Apply and Run to start the new R Console. Wait a few seconds while the R console fires itself up. The normal output from R will now show up in the &#8220;console&#8221; window that appears in the lower portion of the workbench. In the Object Browser on the lower left, you should get a list of environmental variables from the current R session. This will include all the packages that you have installed and running (such as the base stats, graphics, MASS etc) and it will also have a &#8220;.GlobalEnv&#8221; item at the top.<\/p>\n<figure id=\"attachment_208\" aria-describedby=\"caption-attachment-208\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_console_started.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-208\" title=\"R_console_started\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_console_started-300x227.png\" alt=\"\" width=\"300\" height=\"227\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_console_started-300x227.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/R_console_started.png 1012w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-208\" class=\"wp-caption-text\">Now we have a R console running, along with the Object Browser showing the items in memory.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">Once you&#8217;ve created some objects in memory, such as data frames or numeric arrays or whatever, they will appear under the .GlobalEnv item. If you mouse-over a particular variable, it will show you a summary of the contents of that item (similar to when you use the str() command in the normal R environment.<\/p>\n<figure id=\"attachment_209\" aria-describedby=\"caption-attachment-209\" style=\"width: 259px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-209\" title=\"Object_browser_example\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_example.png\" alt=\"\" width=\"259\" height=\"266\" \/><\/a><figcaption id=\"caption-attachment-209\" class=\"wp-caption-text\">The Object Browser showing some of the objects I entered in my R console, including a data frame and some character variables.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Incidentally, if you want to edit the contents of a data frame, you&#8217;ll still need to use the<br \/>\n&gt; fix(<em>dataframename<\/em>)<br \/>\nor<br \/>\n&gt; newdata &lt;- edit(<em>dataframename<\/em>)<br \/>\ncommands to make your changes. This functions just like it did in the R-Gui window, but you obviously can do it from the command prompt in your Eclipse\/StatET environment.<\/p>\n<p>Note that you can use the Object browser to filter certain objects using the search field, or you can choose to only display objects of a certain type by clicking the down-arrow on the upper left of the Object Browser window. If you only want to see your objects and not all the packages you have installed, choose the &#8220;Show non-package Variables only&#8221; item.<\/p>\n<figure id=\"attachment_210\" aria-describedby=\"caption-attachment-210\" style=\"width: 518px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_filtering.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-210\" title=\"Object_browser_filtering\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_filtering.png\" alt=\"\" width=\"518\" height=\"175\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_filtering.png 518w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_filtering-300x101.png 300w\" sizes=\"auto, (max-width: 518px) 100vw, 518px\" \/><\/a><figcaption id=\"caption-attachment-210\" class=\"wp-caption-text\">Use this option to hide all of the objects contained in the R packages you have installed. This leaves only the objects that you create during your R session.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Having the package variables displayed can be helpful sometimes, because it lets you stroll through all the functions available in each package. For example, if I click on the &#8216;ncdf&#8217; package, it shows me the various functions\/commands that are available to me from that package. Maybe you&#8217;ll discover an interesting function that you didn&#8217;t previously know existed.<\/p>\n<figure id=\"attachment_211\" aria-describedby=\"caption-attachment-211\" style=\"width: 158px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_package_functions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-211\" title=\"Object_browser_package_functions\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Object_browser_package_functions-158x300.png\" alt=\"\" width=\"158\" height=\"300\" \/><\/a><figcaption id=\"caption-attachment-211\" class=\"wp-caption-text\">A selection of the various functions contained in the ncdf package. <\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>_______________________________<br \/>\nThe last thing to set up is the script editing window. If you&#8217;ve used R much, you know that it&#8217;s often easiest to write scripts, i.e. lists of commands, in a file that you then submit to the R console to process. The Eclipse\/StatET environment provides a script editor.<\/p>\n<p>To write a new .R file, go to File&gt;New&gt;R-Script File. In the window that pops up, choose a folder to save this new file in. This will probably be the folder for your R environment that you created. In the &#8220;File name&#8221; field below, enter a name for you new .R file, and hit Finish.<\/p>\n<figure id=\"attachment_212\" aria-describedby=\"caption-attachment-212\" style=\"width: 284px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/New_R-Script_file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-212\" title=\"New_R-Script_file\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/New_R-Script_file-284x300.png\" alt=\"\" width=\"284\" height=\"300\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/New_R-Script_file-284x300.png 284w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/New_R-Script_file.png 521w\" sizes=\"auto, (max-width: 284px) 100vw, 284px\" \/><\/a><figcaption id=\"caption-attachment-212\" class=\"wp-caption-text\">Create a new R-Script file. Choose a destination folder and give the script file a name.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>Now a new file will open up in the R script editor on the work bench. This provides colored syntax highlighting, inserts closing parentheses and quotes, highlights possible syntax errors and so on. You can submit the whole script or just a highlighted section using the Run menu.<\/p>\n<figure id=\"attachment_213\" aria-describedby=\"caption-attachment-213\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Rscript_editor.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-213\" title=\"Rscript_editor\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Rscript_editor-300x168.png\" alt=\"\" width=\"300\" height=\"168\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Rscript_editor-300x168.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Rscript_editor.png 554w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-213\" class=\"wp-caption-text\">The script editor with syntax highlighting.<\/figcaption><\/figure>\n<p style=\"text-align: center;\">\n<p>_______________________<\/p>\n<p>Working in the Eclipse\/StatET environment provides you with some extra features over just working in a normal R-Gui console. The biggest one is that you can &#8220;filter&#8221; through previous commands. You&#8217;ll recall that in the normal R-Gui, if you hit the Up Arrow while sitting at the command prompt, you can scroll through all the previous commands you&#8217;ve entered, in order. But sometimes the command you want to get to is quite a while back and you don&#8217;t want to have to type the whole thing again. In the Eclipse\/StatET R console, you can type the first few letters of the command, then hit Ctrl + Alt + Up Arrow to cycle through the previously-used commands that start with those letters. If there are multiple potential matches, you just keep hitting Ctrl + Alt + Up Arrow until you find the right one.<\/p>\n<p>For example, in the image below, I entered &#8220;str(data)&#8221; several steps previously, as you can see at the top of the console output. On the command prompt at the bottom, I&#8217;ve typed &#8220;str&#8221; again. If I now hit Ctrl + Alt + Up Arrow, Eclipse\/StatET will automatically fill in &#8220;str(data)&#8221; and I can just hit Return to run that command. This is more useful than just hitting the Up Arrow repeatedly when you&#8217;re trying to re-enter long commands that you entered many steps back.<\/p>\n<figure id=\"attachment_214\" aria-describedby=\"caption-attachment-214\" style=\"width: 422px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Console_ctrl_up_example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-214\" title=\"Console_ctrl_up_example\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Console_ctrl_up_example.png\" alt=\"\" width=\"422\" height=\"325\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Console_ctrl_up_example.png 422w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/04\/Console_ctrl_up_example-300x231.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/a><figcaption id=\"caption-attachment-214\" class=\"wp-caption-text\">A view of the R console in Eclipse, and the command prompt at the bottom.<\/figcaption><\/figure>\n<p style=\"text-align: left;\">Hitting Ctrl + space bar at the command prompt shows you a list of objects that you currently have in memory as well. If you type the first few letters of an object name, Ctrl + space bar will only show you the potential matches that have those letters.<\/p>\n<p>You&#8217;ll also notice that Eclipse\/StatET will do things like automatically fill in closing parentheses and closing quotes for you when you start typing those sorts of things, which can save you a few keystrokes here and there.<\/p>\n<p>Some things will remain unchanged from how they worked when you used the standard R-Gui. When you plot data, the new plots spawn in their own window outside of the Eclipse environment, just like you&#8217;re used to.\u00a0 If you use the fix() or edit() commands to get to the data editor, the data editor window will also pop up outside the Eclipse environment, just like when you run R from the normal R-Gui.<\/p>\n<p>Finally, for normal usage, you&#8217;ll now start Eclipse rather than starting R by itself. Once your Eclipse environment is up and running, you run R from within the Eclipse environment, as outlined above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to use Eclipse and StatET to create a handy-dandy development environment for R. Using the Eclipse environment provides a nice colored-syntax script editor, an R console, and an object browser to let you peruse the variables you&#8217;ve put into memory. If you&#8217;re a Matlab or Systat refugee, this arrangement may be the closest you can get to those programs&#8217; user interfaces. <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[218],"tags":[14,7,58,15],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-r-project","tag-eclipse","tag-r","tag-r-project","tag-statet"],"_links":{"self":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":14,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":746,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions\/746"}],"wp:attachment":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}