Rcmdr (version 2.1-3)

Commander: R Commander

Description

Start the R Commander GUI (graphical user interface)

Usage

Commander()

Arguments

Warning

The R Commander Script window does not provide a true console to R, and may have certain limitations. I don't recommend using the R Commander for serious programming or for data analysis that relies primarily on scripts --- use a programming editor instead. If you encounter any problems with the Script tab, however, I'd appreciate it if you brought them to my attention.

Known Problems

Occasionally, under Windows, after typing some text into a dialog box (e.g., a subsetting expression in the Subset Data Set dialog), buttons in the dialog (e.g., the OK button) will have no effect when they are pressed. Clicking anywhere inside or outside of the dialog box should restore the function of the buttons. As far as I have been able to ascertain, this is a problem with Tcl/Tk for Windows. I have not seen this behavior in some time and the problem may have been solved.

Platform-Specific Issues

Under Windows, the Rcmdr package can be run under the Rgui in the SDI (single-document interface) mode, or under rterm.exe. You might experience problems running the Rcmdr under ESS with NTEmacs or XEmacs; under other R consoles; or under the Rgui in the MDI (multiple-document interface) mode. Under Mac OS X Mavericks, the R Commander may appear to freeze or hesitate when run under R.app if the R.app window is hidden and "app nap" is turned on. It is recommended that app nap be turned off for R.app, which can be most conveniently done via the R Commander Tools menu. The app nap setting is permanent until changed and so the current setting will apply whether or not the R Commander is used. When R is first installed, app nap will be on for R.app. The tcltk package requires that X Windows is installed under Mac OS X, and as a consequence the Rcmdr package, which depends on tcltk, will not load if X Windows is absent. X Windows for Mac OS X may be obtained from http://xquartz.macosforge.org.

Details

Getting Started

The default R Commander interface consists of (from top to bottom) a menu bar, a toolbar, a code window with script and R Markdown tabs, an output window, and a messages window.

Commands to read, write, transform, and analyze data are entered using the menus in the menu bar at the top of the Commander window. Most menu items lead to dialog boxes requesting further specification. I suggest that you explore the menus to see what is available.

Below the menu bar is a toolbar with (from left to right) an information field displaying the name of the active data set; buttons for editing and displaying the active data set; and an information field showing the active statistical model. There is also a Submit button for re-executing commands in the Script tab. The information fields for the active data set and active model are actually buttons that can be used to select the active data set and model from among, respectively, data frames or suitable model objects in memory.

Almost all commands require an active data set. When the Commander starts, there is no active data set, as indicated in the data set information field. A data set becomes the active data set when it is read into memory from an R package or imported from a text file, SPSS data set, Minitab data set, STATA data set, or an Excel, Access, or dBase data set. In addition, the active data set can be selected from among R data frames resident in memory. You can therefore switch among data sets during a session.

By default, commands are logged to the Script tab (the initially empty text window immediately below the toolbar), and commands and output appear in the Output window (the initially empty text window below the Script tab). Commands that don't require direct user interaction (such as interactive identification of points on a graph) are also used to create an R Markdown document in the tab of the same name. When the R Markdown tab is in front, pressing the "Generate HTML report" button compiles the document to create an html page with input and output, which opens in a web browser. To alter these and other defaults, see the information below on configuration. Note, for example, that the knitr package can be used to create a LaTeX document to be compiled to a PDF report, as an alternative to --- or in addition to --- an R Markdown document (see the use.knitr option below). Some Rcmdr dialogs (those in the Statistics -> Fit models menu) produce linear, generalized linear, or other models. When a model is fit, it becomes the active model, as indicated in the information field in the R Commander toolbar. Items in the Models menu apply to the active model. Initially, there is no active model. If there are several models in memory, you can select the active model from among them.

If command logging in turned on, R commands that are generated from the menus and dialog boxes are entered into the Script and R Markdown tabs in the Commander. You can edit these commands in the normal manner and can also type new commands. You can also type explanatory text in the R Markdown tab. Individual commands in the Script tab can be continued over more than one line, but the several lines of a multi-line command must be submitted simultaneously. (It is not necessary, as in earlier versions of the R Commander, to begin continuation lines with white space.) The contents of the Script and R Markdown tabs can be saved during or at the end of the session, and a saved script or R Markdown document can be loaded into the respective tabs. The contents of the Output window can also be edited or saved to a text file. Finally, editing operations also work in the Messages window.

To re-execute a command or set of commands in the Script tab, select the lines to be executed using the mouse and press the Submit button at the right of the toolbar (or Control-R, for "run", or Control-Tab). If no text is selected, the Submit button (or Control-R or Control-Tab) submits the line containing the text-insertion cursor. Note that an error will be generated if the submitted command or commands are incomplete.

Pressing Control-F brings up a find-text dialog box (which can also be accessed via Edit -> Find) to search for text in the Script tab, R Markdown tab, knitr tab, Output window, or Messages window. Edit functions such as search are performed in the Script tab unless you first click in another tab or window to make it active.

Pressing Control-S will save the Script tab, R Markdown tab, knitr tab, or Output window.

Pressing Control-A selects all of the text in the Script tab, R Markdown tab, knitr tab, Output window, or Messages window.

In addition, the following Control-key combinations work in these tabs and windows: Control-X, cut; Control-C, copy; Control-V, insert; Control-Z or Alt-Backspace, undo; and Control-W, redo.

Under Mac OS X, the command key may be used in place of the Control key, though the latter works as well.

Right-clicking the mouse (clicking button 3 on a three-button mouse, or Control-left-clicking) in the tabs or windows brings up a "context" menu with the Edit-menu items, plus (in the Script, R Markdown, and knitr tabs) a Submit item.

You can open a larger editor window with the document in the Markdown or knitr tab by making the corresponding selection from the Edit menu, the right-click context menu when the cursor is in the tab, or by pressing Control-E when the cursor is in the tab.

When you execute commands from the Commander window, you must ensure that the sequence of commands is logical. For example, it makes no sense to fit a statistical model to a data set that has not been read into memory.

Pressing a letter key (e.g., "a") in a list box will scroll the list box to bring the next entry starting with that letter to the top of the box.

You can cancel an R Commander dialog box by pressing the Esc key.

Most R Commander dialogs remember their state when this is appropriate, and can be restored to pristine state by pressing the Reset button.

Some R Commander dialogs have an Apply button that will execute the command generated by the dialog and then re-open the dialog in its previous state.

Exit from the Commander via the File -> Exit menu or by closing the Commander window.

Customization and Configuration

The preferred way of customizing the R Commander is to write a plug-in package: see help("Plugins").

Alternatively, configuration files reside in the etc subdirectory of the package, or in the locations given by the etc and etcMenus options (see below).

The Rcmdr menus can be customized by editing the file Rcmdr-menus.txt.

You can add R code to the package, e.g., for creating additional dialogs, by placing files with file type .R in the etc directory, also editing Rcmdr-menus.txt to provide additional menus, sub-menus, or menu-items. Alternatively, you can edit the source package and recompile it.

To reiterate, however, the preferred procedure is to write an R Commander plug-in package.

A number of functions are provided to assist in writing dialogs, and Rcmdr state information is stored in a separate environment. See help("Rcmdr.Utilities") and the manual supplied in the doc directory of the Rcmdr package for more information.

In addition, several features are controlled by run-time options, set via the options("Rcmdr") command. These options should be set before the package is loaded. If the options are unset, which is the usual situation, defaults are used. Specify options as a list of name=value pairs. You can set none, one, several, or all options. The available options are as follows:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Some options can also be set via the File -> Options menu, which will restart the Commander after options are set.

If you want always to launch the R Commander when R starts up, you can include the following code in one of R's start-up files (e.g., in the Rprofile.site file in R's etc subdirectory):

local({ old <- getOption("defaultPackages") options(defaultPackages = c(old, "Rcmdr")) })

R Commander options can also be permanently set in the same manner. For more information about R initialization, see ?Startup.

References

Fox, J. (2005) The R Commander: A Basic Statistics Graphical User Interface to R. Journal of Statistical Software, 14(9): 1--42.

Fox, J. (2007) Extending the R Commander by "plug in" packages. R News, 7(3): 46--52.

See Also

Plugins, Rcmdr.Utilities, knit, knit2pdf

Examples

Run this code
options(Rcmdr=list(log.font.size=12, default.contrasts=c("contr.Sum", "contr.poly")))

Run the code above in your browser using DataCamp Workspace