# Please make sure it is your own work. Please read the study guide. Please watch out for spelling and grammar errors. Please us

Please make sure it is your own work. Please read the study guide. Please watch out for spelling and grammar errors. Please use the APA 7th edition.

Book Reference:Fox, J. (2017). *Using the R Commander: A point-and-click interface for R*. CRC Press. https://online.vitalsource.com/#/books/9781498741934

Part I: Introduce yourself to your classmates with your name, location, current employment, and future goals.

Part II: What is a potential research topic you are interested in? How might you use a quantitative methodology in your future doctoral research study?

**1**

*Introducing R and the R Commander*

This chapter introduces R and the R Commander, explaining what they are and where they came from. The chapter also outlines the contents of the book, shows how to access the web site for the book, and describes the typographical conventions used in the text.

**1.1 What Are R and the R Commander?**

The R Commander—the subject of this book—is a point-and-click *graphical user interface* (*GUI*) for R, allowing you to use R statistical software through familiar menus and dialog boxes instead of by typing commands. Throughout the book, I assume that the statistical methods covered are familiar to you—or that you’re concurrently learning them in a statistics class or by independently reading a complementary statistics text. The object of the book is to show you how to perform data analysis with the R Commander employing common statistical methods, not to teach the statistical methods themselves.

An implication of this approach is that you should feel free to skip those parts of the book that take up statistical methods with which you’re unfamiliar. For example, most of the material in Chapter 7, on working with statistical models in the R Commander, is beyond the level of a typical basic statistics course. Sections that deal with relatively advanced or difficult material are marked with asterisks.

R is highly capable, free, open-source statistical software. Although it is hard to know with any certainty how many people use R, it is—for example, judging by Internet traffic—possibly the most popular statistical software in the world. R is, in any event, very widely used, and its use is growing rapidly!

R incorporates a programming language that is finely adapted to the development of statistical applications. Rdescends from the S programming language, originally developed in the 1980s by statisticians and computer scientists at Bell Labs, led by John Chambers (see, e.g., Becker et al., 1988). Indeed, R can be regarded as a dialect of S. Eventually incorporated in a commercial product called S-PLUS, S was popular among statisticians prior to the development of R. At present, the free, open-source R has entirely eclipsed its commercial cousin S-PLUS.

R is *free* software in Richard Stallman’s famously dual sense of the term (Stallman, 2002):1 It is free in the obvious sense of being costless, but also in the deeper sense that users may freely modify and distribute R. Moreover, R is licensed under the Free Software Foundation’s General Public License (GPL)—a “viral copy-left” that prevents individuals or companies from restricting users’ freedom to modify further and redistribute R. Freedom in the second sense essentially presupposes that R is *open source*: that is, that R is distributed not only as an executable program but also that the source code for R (written in a variety of programming languages, including in R itself) is available to interested users. For more information about R, visit the R web site at https://www.r-project.org/. The R Commander is also free, open-source software distributed under the GPL.

Analyzing data with R doesn’t necessarily entail writing programs in the R language, because the basic Rdistribution comes with impressive built-in statistical functionality. The capabilities of the standard R distribution, however, are greatly extended by (as I write this) nearly 8000 user-contributed R add-on *packages*, freely available on the Internet through the Comprehensive R Archive Network (abbreviated CRAN, and alternatively pronounced as “kran” or “see-ran”; see https://cran.r-project.org/). Moreover, roughly 1000 additional R packages are available through the closely associated Bioconductor Project (http://bioconductor.org/), which develops software primarily for bioinformatics (genonomics).

Whether you write your own R programs or use pre-packaged programs, standard data analysis in R consists of typing commands in the R language. As a simple example, to compute the mean of the variable income, you might type the command mean(income), invoking the standard R mean *function* (program). Similarly, to perform a linear least-squares regression of income on years of education and years of labor-force experience, you might issue the command lm(income ~ education + experience), employing the lm (linear-model) function. Learning to write R commands like these is an important skill and ultimately is the most efficient way to use R (see Section 1.4), but it can present a formidable obstacle to new, occasional, or casual users of R.

**1.2 A Brief History of R and the R Commander**

R began around 1990 as the personal project of Robert Gentleman and Ross Ihaka, two statisticians then at Auckland University in New Zealand (see Ihaka and Gentleman, 1996). Gentleman and Ihaka in effect grafted the syntax of the pre-existing statistical programming language S onto the Scheme dialect of Lisp, a programming language usually associated with work in artificial intelligence. This turned out to be a propitious choice, because, as mentioned, the Slanguage was already widely used by statisticians.

Eventually Ihaka and Gentleman advertised their work on the Internet, attracting several other developers to the project, including John Chambers, the principal developer of S. Then, in 1997, the *R Project for Statistical Computing* was formalized, with a Core team of nine developers, a number that has since expanded to 20, many of whom are significant figures in the field of statistical computing. The R Core team is responsible for the continued development and maintenance of the basic R distribution.

As I explained, R is distributed under the free-software General Public License. The copyright to R is held by the R Foundation, which comprises the members of the R Core team along with about a dozen other individuals; I’m an elected member of the R Foundation.

The growth of R has been nothing short of amazing. Figure 1.1 shows, for example, the expansion of the CRAN Rpackage archive over the 14-year period for which I was able to obtain data.2 The horizontal axes of the graph record R versions and corresponding dates, while the vertical axes show the number of CRAN packages on a logarithmic scale, so that a linear trend represents exponential growth.3 The line on the graph was fit by least-squares regression.4You can see from Figure 1.1 that, while the growth of CRAN was originally approximately exponential, its rate of growth has more recently slowed down. The slope of the least-squares line suggests that, on average over this period, CRAN expanded at a rate of about 35 percent a year.

FIGURE 1.1: The growth of CRAN. The vertical axes show the number of CRAN packages on a log scale, while dates and corresponding minor R versions are shown at the bottom and top of the graph, respectively. The line on the graph was fit to the points by least-squares regression. Two R versions, 1.6 and 2.14, are omitted because their recorded dates were very close to the dates of the previous versions.

*Source:* Updated from Fox, “Aspects of the social organization and trajectory of the R Project,” *The R Journal*, 1(2): 5–13, 2009.

*Source of Data:* Downloaded from https://svn.r-project.org/R/branches/ on 2016-03-03.

As I mentioned in the Preface to this book, I began to work on the R Commander around 2002, and I contributed version 0.8-2 of the **Rcmdr** package to CRAN in May 2003. The first “non-beta” version, 1.0-0, appeared two years later, and was described in a paper in the *Journal of Statistical Software* (Fox, 2005), an on-line journal of the American Statistical Association. In March 2016, when I wrote the chapter you’re reading, that paper had been downloaded nearly 140,000 times—despite the fact that it was more than 10 years out of date!

I have continued to develop the R Commander in the intervening period: Version 1.1-1, which also appeared in 2005, introduced the capability to translate the R Commander interface into other languages, a feature supported by R itself, and there are now 18 such translations (counting Chinese and simplified Chinese as separate translations). In 2007, Version 1.3-0 first made provision for R Commander plug-in packages, and there are currently about 40 such plug-ins on CRAN. In 2013, Milan Bouchet-Valat joined me as a developer of the R Commander, and version 2.0-0, released in that year, featured a revamped, more consistent interface—for example, featuring tabbed dialogs.

__Chapter 2__ describes how to download R from the Internet and install it and the R Commander on Windows, Mac OS X, and Linux/Unix systems. If you have already successfully installed R and the R Commander, then feel free to skip the chapter. There is, however, some troubleshooting information, to which you can make reference if you experience a problem.

__Chapter 3__ introduces the R Commander graphical user interface (GUI) by demonstrating its use for a simple problem: constructing a contingency table to examine the relationship between two categorical variables. In developing the example, I explain how to start the R Commander, describe the structure of the R Commanderinterface, show how to read data into the R Commander, how to modify data to prepare them for analysis, how to draw a graph, how to compute numerical summaries of data, how to create a printed report of your work, how to edit and re-execute commands generated by the R Commander, and how to terminate your R and R Commander session—in short, the typical work flow of data analysis using the R Commander. I also explain how to customize the R Commander interface.

__Chapter 4__ shows how to get data into the R Commander from a variety of sources, including entering data directly at the keyboard, reading data from a plain-text file, accessing data stored in an R package, and importing data from an Excel or other spreadsheet, or from other statistical software. I also explain how to save and export R data sets from the R Commander, and how to modify data—for example, how to create new variables and how to subset the active data set.

__Chapter 5__ explains how to use the R Commander to compute simple numerical summaries of data, to construct and analyze contingency tables, and to draw common statistical graphs. Most of the statistical content of the chapter is covered in a typical basic statistics course, although a few topics, such as quantile-comparison plots and smoothing scatterplots, are somewhat more advanced.

__Chapter 6__ shows how to compute simple statistical hypothesis tests and confidence intervals for means, for proportions, and for variances, along with simple nonparametric tests, a test of normality, and correlation tests. Many of these tests are typically taken up in a basic statistics class, and, in particular, tests and confidence intervals for means and proportions are often employed to introduce statistical inference.

__Chapter 7__ explains how to fit linear and generalized linear regression models in the R Commander, and how to perform additional computations on regression models once they have been fit to data.

__Chapter 8__ explains how to use the R Commander to perform computations on probability distributions, to graph probability distributions, and to conduct simple random simulations.

__Chapter 9__ explains how to use R Commander *plug-in packages*. The capabilities of the R Commander are substantially augmented by the many plug-in packages for it that are available on CRAN. Plug-ins are R packages that add menus, menu items, and dialog boxes to the R Commander. I show you how to install plug-in packages, and illustrate the application of R Commander plug-ins by using the **RcmdrPlugin.TeachingDemos** package and the **RcmdrPlugin.survival** package as examples.

An appendix to the book displays the complete set of R Commander menus, along with cross-references to the text.

If you become a frequent user of R, you’ll likely graduate from the R Commander to writing your own R commands and possibly your own R programs. There are several reasons to employ the command-line interface to R in preference to a GUI like the R Commander:

• The R Commander GUI provides access to only a small fraction of the capabilities of R and the many R packages available on CRAN. To take full advantage of R, therefore, you’ll have to learn to write commands.

• Even if you limit yourself to the capabilities in the R Commander and its various plug-ins, frequent users of R find the command-line interface more efficient. Once you remember the various commands and their arguments, you’ll learn to work more quickly at the command line than in a GUI.

• You’ll find that a little bit of programming goes a long way. Writing simple scripts and programs is often the quickest and most straightforward way to perform data management tasks, for example.

If you do decide to learn to use R via the command-line interface, there are many books and other resources to help you. For example, I and Sanford Weisberg have written a text (Fox and Weisberg, 2011) that introduces R, including Rprogramming, in the context of applied regression analysis. See the *Documentation* links on the R home page at __https://www.r-project.org/__ for many alternative sources, including free resources.

The R Commander is designed to facilitate the transition to command-line use of R: The commands produced by the R Commander are visible in the *R Script* tab. The contents of the *R Script* tab may be saved to a file and reused, either in the R Commander or in an R programming editor. Similarly, the dynamic document produced in the R Commander *R Markdown* tab may be saved, edited, and executed independently of the R Commander. These features are briefly discussed in __Chapter 3__ .

Both the Windows and Mac OS X implementations of R come with simple programming editors, but I strongly recommend the RStudio *interactive development environment (IDE*) for command-line use of R. RStudioincorporates a powerful programming editor and is ideal both for routine data analysis in R and for R programming, including the development of R packages—and RStudio supports R Markdown documents. Like R and the R Commander, RStudio is free, open-source software: Visit the RStudio web site at __https://www.rstudio.com/products/rstudio/__ for details, including extensive documentation.

I have created a web site to support this book with a variety of resources, including:

• all the data files used in examples that appear in the text

• detailed (and potentially updated) installation instructions, including trouble-shooting information, beyond the instructions in __Chapter 2__

• information about significant updates to the R Commander following the publication of this book, along with errata correcting errors in the book (as they, almost inevitably, reveal themselves)

• a manual for authors of R Commander plug-in packages

A note about software versions: Although some of the “screenshots” and output in this book were produced with earlier versions, the book is current as of version 3.2.3 of R and version 2.1-4 of the **Rcmdr** package. Significant changes to the R Commander or changes to R that affect the R Commander will be addressed on the web site for the book.

Chapman and Hall maintains a link to the web site for the book at __https://www.crcpress.com/Using-the-R-Commander-A-Point-and-Click-Interface-for-R/Fox/p/book/9781498741903__ , which can also be accessed at __http://tinyurl.com/RcmdrBook__ .

Different typefaces and fonts are used to distinguish the following elements:

• Computer software, such as operating systems (Windows, Mac OS X, Linux) and statistical software (R, the R Commander) are shown in a sans serif typeface.

• Graphical user interface components, such as menus (the *Edit* menu) and windows (the *R Console* window, the *Two-Way Table* dialog box), are shown in an *italic typeface*.

• Submenu and menu item selection is indicated by > (a greater than sign). Thus, for example, *Statistics* > *Summaries*> *Numerical summaries*… means “left-click on the *Statistics* menu, then on the *Summaries* submenu, and finally on the *Numerical summaries*… menu item.” Three dots following a menu item (as in *Numerical summaries*…) indicates that selecting the item leads to a dialog box, rather than performs a direct action. I will usually omit the three dots from menu items, however.

• Keys (e.g., *Tab*) and key combinations (*Ctrl-c*) are also shown in an *italic typeface*. The key combination *Ctrl-c*, for example, means “hold down the *Ctrl* key and press the *c* key.”

• R packages (such as the **Rcmdr** and car packages) are shown in boldface.

• Text meant to be typed directly (such as the R command library(Rcmdr), or text to be typed into an R Commander dialog box) is shown in a typewriter font, as is R output, and as are the names of R objects, such as functions (mean), data sets (States), and variables in data sets (pay). Generic text (e.g., *variable-name*) meant to be replaced with specific text (e.g., income) is shown in an *italic typewriter font*. • Files (GSS.csv) and file paths (C:Program FilesRR-x.y.z) are also shown in typewriter font, with generic text again in *typewriter italics*.

• Internet URLs (addresses) are shown in a sans serif typeface (e.g., https://cran.r-project.org).

• When important, possibly unfamiliar, terms are introduced, they are set in *italics* (e.g., *rectangular data set*).

1Richard Stallman is the founder of the Free Software Foundation, with which the R Project for Statistical Computing is associated.

2This graph is updated from Fox (2009), where I discuss the social organization and trajectory of the R Project.

3If you’re unfamiliar with logs, don’t be concerned: The essential point is that the scale gets more compressed as the number of packages grows, so that, for example, the distance between 100 and 200 packages on the log scale is the *same* as the distance between 200 and 400, and the same as the distance between 400 and 800—all of these equal distances represent *doubling* the number of packages.

4Again, if you’re unfamiliar with the method of least squares, don’t worry: You’ll almost surely study the topic in your basic statistics course. The essential idea is that the line comes as close (in a sense) to the points on average as possible.

* Installing R and the R Commander*

This chapter describes how to download R from the Internet and install it and the R Commander on Windows, Mac OS X, and Linux/Unix systems. If you have already successfully installed R and the R Commander, then feel free to skip the chapter. There is, however, some troubleshooting information, to which you can make reference if you experience a problem.

** 2.1 Acquiring and Installing R and the R Commander**

More detailed (and potentially more up-to-date) information on installing R and the **Rcmdr** package appears on the web site for this book. Please consult the web site if the information provided here proves insufficient, or if you encounter difficulties not discussed here.

R and R packages, like the **Rcmdr** package, are available on the Internet from CRAN (the Comprehensive R Archive Network—see __Chapter 1__ ) at __https://cran.r-project.org__ . It is best not to download R and R packages directly from the main CRAN web site, however, but rather to use a CRAN *mirror site*. A link to a list of CRAN mirrors appears at the upper left of the CRAN home page (the top of which is shown in __Figure 2.1__ ). I suggest that you use the first “0-Cloud” mirror, which is generally both reliable and fast.

Regardless of whether you are a Windows user, a Mac OS X user, or a Linux/Unix user, I recommend that you install the current version of R, say R version *x.y.z*. In this generic version number, *“x”* represents the *major version, “y”* the *minor version*, and *“z”* the *patch version* of R. A new minor version of R, *x.y.0*, is released by the R Core team each spring, and patch versions are released as needed, typically to fix bugs. Major versions appear infrequently, and only when substantial modifications are made to the base R software. As I’m writing this book, the current version of R is 3.2.3. __1__

There are (at most) five steps to installing R and the R Commander:

1. Download and install R.

2. On Mac OS X only, download and install the XQuartz windowing software.

3. Start R and install the **Rcmdr** package.

4. Load the **Rcmdr** package and, when asked, allow it to install additional packages.

5. If desired, optionally download and install Pandoc and LATEX software for producing enhanced reports (as described in __Section 3.6__ ).

Specific instructions for Windows, Mac OS X, and Linux/Unix systems follow.

FIGURE 2.1: The top of the Comprehensive R Archive Network (CRAN) home page (on 2015-10-04).

** 2.2 Installing R and the R Commander under Microsoft Windows**

From the home page of the mirror you selected, click on the link *Download R for Windows*, which appears near the top of the page. Then click on *install R for the first time*, and subsequently on *Download R* x.y.z *for Windows*.

Once it is downloaded, double-click on the R installer. On Windows 10, you will see a frightening message: “Windows protected your PC. Windows SmartScreen prevented an unrecognized app from starting. Running this app might put your PC at risk.” Click on *More info* and then on the *Run anyway* button. (Why not live dangerously?) Windows issues this warning if your user-account controls are at the default settings and you download software that’s not from the Windows App Store.

You may take all of the defaults in the R installer, but I suggest that you make the following modifications:

• Instead of installing R in the standard location, typically C:Program FilesRR-*x.y.z* (for R version *x.y.z*), you may use C:RR-*x.y.z*. This will allow you to install packages in the main R package library on your computer without running R with administrator privileges.

If you install R into C:Program FilesRR-x.y.z, and you run R without administrator privileges, you will see a message like the following:

Warning in install.packages(“Rcmdr”) : ‘lib = “C:/Program Files/R/R-x.y.z/library”’ is not writab

**
Collepals.com Plagiarism Free Papers
**

Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we\'ll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.

**Why Hire Collepals.com writers to do your paper?**

Quality- We are experienced and have access to ample research materials.

We write plagiarism Free Content

Confidential- We never share or sell your personal information to third parties.

Support-Chat with us today! We are always waiting to answer all your questions.