Windows Help

In the CRDMA labs, we have Windows and Linux workstations.  We have a separate sheet for Mac installs,

The following is a tip sheet we keep for Windows setups.


Software Installation

Carefully install R AND make sure R executables are in the path

1. Find the R installer

The program for installing R can be found at  That's the CRMDA mirror of the Comprehensive R Archive Network (CRAN). Under "Download for Windows", find the one they label "base," which is described as the one you want to "install R for the first time".

The R installer package has a name like "R-3.3.1-win.exe" and it includes both the 32bit and 64bit versions of R. It is now preferred to run with the 64 bit version. However, the installer includes both because there are still some R packages that do not work at all on 64 bit. So you need both, even though you only intend to use 64bit.

2. Run the installer, but change the default path that R suggests

The R installer has some assumptions about where you want to install R.  They install R as if you are an R developer, someone who will keep several versions of R on the system. We (almost never) want that. If you allow R to do what it wants, it will install into a version-specific folder like this:

C:\Program Files\R\R-3.3.1

We'd rather not, however, this makes some chores more difficult over the long term. Instead, change the install folder to

C:\Program Files\R

and under there, the R libraries and executables can be found.

3. Add C:\Program Files\R\bin\x64 to the Window System path.

Why? We want other programs to know where R can be found.

How to do that? Use the Windows Control Panel, System, Advanced Settings, Environment, and navigate to PATH and at the end of PATH, add ";c:\Program Files\R\bin\x64".  Note the format, it uses semicolons to separate entries.

This simplifies updated and system management.  One advantage of the approach is that the addon packages that get installed will go into a permanent location that will be respected when R is updated in the future:

C:\Program Files\R\library

When R is updated, it will inherit the library folder. 

The change in the system PATH will take effect if you log out, and log in again.

4. Update the packages

Right click on the R icon (in system menu) and choose run as administrator.  That gives you the right to install packages in the protected space under C:\Program Files\R.  Run this command in the new R session. This lfour-line R program updates packages that were provided with the R base, which you just installed. If you copy and paste this into the R terminal session, be careful that the quotation marks are not destroyed by copying onto the clipboard.  We notice they are often turned into other symbols by a web browser.

CRAN <- ""
KRAN <- ""
options(repos = c(KRAN, CRAN))
update.packages(ask = FALSE, checkBuilt = TRUE)

If you forget to run with a right-click "as administrator" then R will not crash, but it will stop and say something like "You don't have permission to install into C:\Program Files\R\library. Would you like us to create a personal user R package library for you? If you say yes, that will create a folder for you like "C:\Users\your-name\Documents\R". Installing in there is just as good as in the "C:\Program Files\R", it is just a matter of taste where you want the packages to be.

After that, run this to review the packages that exist, while still in the R session,


Close R by typing this into the session


Almost always, answer NO when it asks if you want to save the session workspace.

5. Install some new R packages

This is a nice way to test the system. When you want to install, you get a bare-bones set of "recommended packages."

If you start R, not as an administrator, then run this:

CRAN <- ""
KRAN <- ""
options(repos = c(KRAN, CRAN))
install.packages(c("rockchalk", "car"), dep = TRUE)

There are now thousands (and thousands) of R packages.  On some systems, we literally do install everything.  It takes about 5 hours. In case you want to do that, we have a script, "R-labInstallALl.R" which can do that. We don't recommend that you do that. Instead, install what you need as you go.  Everybody will need "car" and "rockchalk at some point (Everybody at KU, at least, will need the latter).

Automatic R package updates in Windows

In our lab systems, we have a scheduled task that runs every night to make sure all packages are installed and up to date. The basic idea is not complicated.  We need R to start as Administrator and run a command like

update.packages(ask = FALSE, checkBuilt = TRUE, repos = c(""))

Then all packages will be brought up to date with the installed version of R. 

We have R programs that can install all or just some particular R programs and trigger that update every night.  The Windows Task Scheduler can be used to do this.

Alternative Editors (Development Environments) We Install

We prepared a video demonstration of the troubles that users will encounter with the R editor for Windows. Look on Youtube, "StartR-02", That demonstrates installation and usage of Emacs, Notepad++, and RStudio.

R for Macintosh comes with a pretty good editor. There is also a very nice version of Emacs for Macintosh.  This page is about Windows, so here we go.

1. Emacs. A long-standing classic. Available on all platforms. Comprehensive features for code development and debugging of running programs.  The only editor endorsed in the official R FAQ.  One can open an R file for editing, and then launch an interactive session with R which is displayed in a separate Emacs frame.  To connect the editor session with to R, there is a module called ESS ("Emacs Speaks Statistics"). There is a slideshow about Emacs called "Emacs has no Learning Curve" that might help: Emacs is available on all platforms and it is the only editor with many of the detailed programming tools needed to do serious R development research. 

Where to get it? There is a very well packaged version offered by Professor Vincent Goulet, we have used it for years without complications:  After installing Emacs, we insert a customized initialization file that has settings we recommend in our labs:  That file should be inserted in the Emacs program folder, under lisp\site.start.d. If our custom init file is used, commands typed into the file editing window can be sent to the *R* with a keyboard shortcut "Shift+Enter". Using the base Emacs with ESS, without our init file, Ctl+Enter does the same. Our custom init file turns settings that will make Emacs have a more "modern" look and feel on Windows. It has Windows style cut and paste (Control-X, Control-V), matching parentheses tool, and most importantly causes Emacs to spawn a new frame (an editor window) in which the R session can exist. Also spawns new frames for R help file display. 

Emacs will work best if the administrator also installs the diffutils from the GNU for Windows project.  It is very important to have the diff.exe executable in a directory that is in the path in order to use Emacs's very powerful version comparison tool  See also Emacs can also interact with version management programs like SVN and Git. It is important for the system administrator to make svn and git available in the system path.

Like the R installer, the Emacs installer wants to install in a version specific folder like "C:\Program Files\GNU Emacs-24.3."  To make life simpler, cut out the version number, install in

C:\Program Files\GNU Emacs

On a production workstation, we would never have 2 versions of Emacs. We put the bin directory of GNU Emacs into the system PATH to make some configurations simpler.

We also run a registry hack that adds a right click option "Open In Emacs" for all files. Note, if you install Emacs in a place that is different, then edit that reg file so it matches your system before installing it into the registry.

Notice that Notepad++ automatically adds that right-click "open with" option by default. I wish Emacs did as well. But we have the registry key and it is easy to install.

2. Notepad++. ( Only for Windows. Also required is the connector program NPPTOR ( can help send commands to R. Notepad++ is popular among our Windows users, but our director is rather adamantly opposed to it because there is no version for Mac or Linux.  It is not helpful to train R programmers who can only use MS Windows.  But the users seem to enjoy it, anyway.

Notepad++ can be configured to offer TAB completion of partially typed commands.  Some users report that this works automatically, but we find it is necessary to set it up manually as follows.

  1. Copy "make_R_xml.r" from NPPTOR install folder to a place where you can read write.
  2. Run that file in R. Can either run as batch or open with Notepad++ and step through line by line. That writes out R.xml file
  3. Copy that file into the place where you installed Notepad++. Go find that in C:\Program Files, then put R.xml in the subfolder Notepad++/plugins/APIs.
  4. Close Notepad++, then re-open it with an R file. Make these changes.
    1. Language menu, choose R.
    2. Settings menu, choose "Backup/Auto-completion"
  5. Turn on autocompletion for functions
  6. Turn on Function parameters hint.

Go back to R document. As soon as you start to type function, the hint on completions pops up. Works well! After you hit "(", then a tooltip line appears reminding of the possible arguments

3. RStudio. ( This is certainly the favorite among R novices. It is available on all platforms, and despite a few little growing pains, it serves reasonably well. It is considerably more feature-rich than the competition. In some ways, it is a bit frustrating to users who are experienced with more general editors like Emacs, but for the ordinary users, it was fine.

We are no longer installing TINN-R and we do not (any longer) pursue WinEDT or Eclipse-STET.

Consider installing Programs in C:\Program Files, even if Windows installer suggests C:\Program Files (x86)

Win7 wants to put 32 bit programs under C:\Program Files (x86) and put only 64 bit programs under C:\Program Files. There is no benefit in doing that, the programs run the same, no matter which directory they inhabit.  Installing programs in the (x86) sub folder just makes it more difficult to type in paths of programs.

Put a HOME folder on the Public Desktop

Win7 tries to hide the user's main folder from access. That is, instead of showing you D:\Users\pauljohn, they want to only show D:\Users\pauljohn\Desktop or D:\Users\pauljohn\Documents and so forth. But many free software programs will want to use D:\Users\pauljohn for config files, and we shouldn't make it so hard for users to get there.

On the Public Desktop, add a shortcut link to %USERPROFILE%. That should suffice.


Vital "fixups" for the OS

1. Show File Extensions. Always

MS Windows has a terrible tendency to try to hide information from users.  The policy of hiding file extensions is bad. It causes endless confusion that a file called "mything.xlsx" shows  "mything". The user can't "see" that the full filename. The same happens with "mything.tar.gz", which appears as just "mything.tar".

Users who are aware of the problem can fix this in their own accounts. The Explorer has an Options for folder views, and one can uncheck "Hide extensions of known file types." That is tedious for each individual user, so we want to do it on a system level. We have a registry key program that can do this (look for "Show_Known_File_Extensions.reg" in That registry key works for Windows 7.  To apply that registry it, it should be simple, if you are logged in as an Administrator.  Just double-click the reg file.  It is also possible to do this by running regedit (Hit Start, choose Run, type "regedit") and then run File -> Import from there.

In case you don't trust the reg file, here's how to do it manually.  Run regedit as administrator. Navigate to choose HKEY_LOCAL_MACHINE. Choose File/ load hive, then navigate to the NTUSER.DAT file under ??:\Users\Default. It asks for a mount point, tell it anything, such as "mypoint".  After that, you see contents of NTUSER.DAT attached to "mypoint".  In there, go to set this key


right click, create new key Data Type: REG_DWORD Value: HideFileExt Value Data: 0 (0=disabled)

Navigate back to "mypoint", then

File / Unload Hive.

2. Add Emacs to show as a right click "open with" option

Run this registry "hack" to put GNU Emacs in the right click menu for every file: "Emacs-RightClick.reg".  Note, it is important to edit that reg key so that it matches the location where you installed Emacs.

See: tip #2 on this page: 5 Indispensable Tips for Emacs on Windows

CRMDA Calendar

Like us on Facebook
One of 34 U.S. public institutions in the prestigious Association of American Universities
44 nationally ranked graduate programs.
—U.S. News & World Report
Top 50 nationwide for size of library collection.
5th nationwide for service to veterans —"Best for Vets: Colleges," Military Times
Equity & Diversity Calendar

KU Today