http://uit.unt.edu/research

Data Science and Analytics

UITHelp Desk | Training | About Us | Publications | DSA Home

Please participate in the DSA Client Feedback Survey.

Back to the Do it yourself Introduction to R

1.) Downloading R. When you first go to CRAN to download R, you will be prompted to select which operating system you will be using. Once you click on ‘Windows’ you will be confronted with two choices; ‘base’ and ‘contrib’. You only need the ‘base’. Later we will install packages which allow you enjoy all the functioning of R. Once you click on ‘base’ you will be confronted with a page showing (in bold) a link to ‘Download R x.xx.x for Windows’ where the series of x indicate the current version (e.g. 3.3.1). Once you click on the download link; you will be prompted to save the file somewhere on your computer. Saving it to the desktop is fine; there will be no need to keep it after you have installed R.

2.) Installing R. You will need to have administrator privileges in order to install R. Double click on the executable file to install R. The default options/settings as specified during installation will be fine. The program can very easily be customized after installation.

There are three windows you’ll likely use every time you use R. The GUI or console window is the core of the program and can act as both textual input and textual output display. The graphics window, which as the name implies, displays graphical output (e.g. histograms, scatter plots, topographical displays of terrain, 3D perspective plots, thermal images, etc.). The script window displays script (also called syntax, or program code, or input code), which is not necessary, but often preferred as a way of building script with comments (i.e. not working code but disregarded by the console) and proof reading it prior to submitting it for processing...and saving it for later. Once you complete the first three modules of this tutorial website, I would strongly encourage installing and using RStudio -- it is free and has quickly become the most popular way of using R. More information on RStudio can be found at the RStudio home page (https://www.rstudio.com/). RStudio has a panel or 'pane' layout which can be changed by going to "Tools" --> "Global Options" --> then "Pane Layout" so you can arrange the panes however you want. You can also minimize a pane or panes; which is common, so that only the "Source" or scripting pane and the console pane are shown. RStudio also has a default hotkey for submitting highlighted script; pressing both the "Ctrl" and "Enter" keys will submit highlighted script to the console and automatically return focus back to the scripting or "Source" pane. Also, graphs or plots can be brought into a separate window outside of the RStudio suit by clicking on the "Expand" button of the "Plots" pane -- often helpful to enlarge a plot to evaluate its contents. A brief introduction to RStudio may help users become familiar with some of the settings and some preferences using R through RStudio.

3.) The first time you open R. You will be confronted with a window in a window. It is recommended (but not necessary) you change the display by changing the GUI preferences; GUI stands for Graphical User Interface. At the top of the window, click on ‘Edit’ then click on ‘GUI preferences…’. Many of these preferences are self explanatory; but here are a few I use: ‘SDI’ and ‘single window’ which changes the console/GUI to a single window display once applied and changes are saved. I prefer font size of 12 which is a little larger and easier for my old eyes to read, but not so large as to dramatically cut down the amount of character lines displayed. I generally change the Pager rows and columns so that the console window is quite large—the specific numbers will be dependent on your screen size/resolution; so it may take some trial and error fiddling to get what you want. I also set the Initial left and top to zero so that the console window opens at the top/left of my screen when I open R. Again, these are merely preferences and each of you should set the program up in a way which is most comfortable for you. Once you have the preferences set how you want them, you will need to SAVE them; regardless of whether or not you apply them. To save your GUI preferences, click the ‘Save…’ button on the bottom of the GUI preferences. You will be prompted to select a directory in which to save the Rconsole. You must save this file in the ‘etc’ directory if you want the changes to be present each time you open the R program; this directory is located inside the R directory where you installed the program, generally at:  

C:\Program Files\R\R-x.xx.x\etc

where x.xx.x refers to the version number of the R installation you have (e.g. R-3.3.1). Once you have saved the GUI preferences, close the program (no need to save workspace image—more on this later) and open it again to make sure the changes have been saved and are being applied.

Congratulations; you now have a working, albeit limited, version of R—and it was completely FREE!

Back to the Do it yourself Introduction to R

Please participate in the DSA Client Feedback Survey.

Contact Information

Jon Starkweather, PhD

Jonathan.Starkweather@unt.edu

940-565-4066

Richard Herrington, PhD

Richard.Herrington@unt.edu

940-565-2140

Last updated: 2018.11.06 by Jon Starkweather.

UITHelp Desk | Training | About Us | Publications | DSA Home