R @RVER@ for Windows
===================

This distribution contains a binary distribution of R-@RVER@ to run on
Windows 95, 98, ME, NT4 and 2000 on Intel/clone chips.  It is designed
to be as close as possible to the implementation on Unix, but see the
list of differences below.  The port was by Guido Masarotto and Brian
Ripley.

We are told this runs on Windows XP release candidates too.

See the file `CHANGES' for the new features of this version.

You will need MSVCRT.dll installed.  It is installed on all recent
Windows installations, but not all 95 machines.  You can download it
from

	ftp://ftp.microsoft.com/softlib/mslfiles/msvcrt.exe

a self-extracting zip archive that contains instructions.


Installation
============

The distribution can be obtained in one of three versions:

1) A 15Mb file SetupR.exe.  Just run this for a Windows-2000 style
installer.  It contains all the R components, and you can select what
want installed.


2) Files miniR.exe and miniR-1.bin to miniR-6.bin.  If you need to,
put miniR.exe and miniR-1.bin on one floppy, and miniR-2.bin to
miniR-6.bin on separate floppies.

This is a small installation, containing text and compiled HTML help
and the Introduction to R and Data Import/Export manuals in PDF.


3) The full distribution consists of several zip files:

@RWVER@b1.zip and @RWVER@b2.zip		the base system
@RWVER@h.zip				text help
@RWVER@ch.zip				compiled HTML help
@RWVER@w.zip				HTML help files
@RWVER@l.zip				latex help files for offline help
@RWVER@d1.zip				PDF manuals except
@RWVER@d2.zip				  PDF version of the reference manual
@RWVER@sp.zip				files to build packages from source

To install, unpack @RWVER@b1.zip and @RWVER@b2.zip anywhere you like.
They will unpack to a directory tree under @RWVER@.  The help,
compiled HTML, HTML and latex help files are in separate files
@RWVER@h.zip, @RWVER@ch.zip @RWVER@w.zip and @RWVER@l.zip which should
be unpacked in the same directory you unpacked @RWVER@b1.zip.

Files @RWVER@d1.zip and @RWVER@d2.zip contains PDF versions of the
manuals for R, which unpack into @RWVER@/doc/manual.

You should install at least one of the text help and the compiled HTML help.

You will need to install the recommended packages separately: see the
rw-FAQ.


Usage
=====

There are two versions of the R executable in @RWVER@\bin:

GUI:

Rgui.exe runs as a standard Windows GUI executable and provides an R
console in its own window.  It takes the standard R command-line
arguments; these are most easily set by making a shortcut to
...\@RWVER@\bin\Rgui.exe and adding the arguments in the Target field.
Set the `Start in' field of the shortcut to the directory you want to use
as the working directory (where workspaces and files are saved and
loaded from).  The SetupR.exe and miniR.exe installers create a
shortcut on the desktop for you (by default).

You have a choice of interface: SDI (separate windows) or MDI
(multiple child windows in one large window).  MDI is the default:
select SDI by adding --sdi in the Target field.

Command-line editing is available: see Help | Console for details.

The menus provide shortcuts to some R commands such as help, help.start,
apropos, ls, load, save.image, search.

The `load' menu items (Source R code, Display file, Load Workspace)
keep track of the directory that was last used, and start their dialog
boxes from that directory the next time they are used.  That directory
can be made the working directory by the File | Change dir menu item.
All the `save' menu items start dialog boxes at the current working
directory: this includes `Save Workspace' and the various ways to save
graphics, as well as saving the workspace at the end of the session.

Note that the text help files use the latin1 encoding.  To see all the
characters you must use an appropriate font (European-language True
Type fonts should be OK).  To check if your preferred font has latin1
capability, try "help(text)" and look at the examples.   [Note: only a
few help files make use of latin1 characters not contained in the
standard ASCII set so if you like a font without latin1 capability,
use it.]


TERMINAL/BATCH:

Rterm.exe will run from a command line such as an MS-DOS or Commands
Window running the standard shells, command.com (9x/ME) and cmd.exe
(NT4/2000), as well as the ports of bash and tcsh that we use.  Its
primary purpose is to allow batch operation, but it does provide all
the facilities needed for interactive use, including command-line
editing (see the file README.Rterm).

Batch use: At its simplest, Rterm.exe can be used in a batch mode by
commands like

Rterm.exe --no-restore --no-save < infile > outfile

although users will probably want to set up simple .bat or .cmd files
to run batch jobs. You can also use it via Rcmd BATCH: see ?BATCH or
Rcmd BATCH --help.  (You will need @RWVER@sp.zip and Perl installed.)

Use with ESS: You can use Rterm.exe to provide inferior R-mode in ESS
under NTEmacs, for example with ess-5.1.18.  The pager is
automatically set to "console" so text help will be displayed in emacs
buffers.


GRAPHICS:

The screen device is called windows().  This is launched automatically,
and can also be launched explicitly by windows() or win.graph() (or
x11()) from both Rgui.exe and Rterm.exe.  A printer device can be
opened using win.print(), and graphs drawn as metafiles by
win.metafile().

The graphics device pops up a separate window which has two menus.  The
device's File menu allows saving or printing or to run dev.off().

The History menu allows the recording of plots.  When plots have been
recorded they can be reviewed by PgUp and PgDn, saved and replaced.
Recording can be turned on automatically (the Recording item on the
list) or individual plots can be added (Add or the INS key).
The whole plot history can be saved to or retrieved from an R variable
in the global environment.

There is only one graphics history shared by all the windows devices.


HELP:

There are several options for help, depending on which help files you
installed.

(i) Text help.  This is the default, and the fallback option.
It will display in the currently set pager (use options(pager=) to change).

(ii) Compiled HTML files.  Set this as the default by
options(chmhelp=TRUE) or for individual help items by help(topic,
chmhelp=TRUE).  Full text search is available from the Search tab.
According to Microsoft, to make use of this you will need to have IE3
or later installed and a recent version of Windows or (not Windows
2000 or ME) use the updater hhupd.exe at
http://msdn.microsoft.com/library/tools/htmlhelp/wkshp/download.htm.

(iii) HTML help to be displayed in your normal browser.  Set this as
the default by options(htmlhelp=TRUE) or for individual help items by
help(topic, htmlhelp=TRUE).  Using help.start() sets the browser to
the top-level page, from which you can access a search engine.

(iv) Latex help files are available for use with help(topic,
offline=TRUE).  You will need to customize the file
@RWVER@\bin\helpPRINT.bat: it contains instructions.

(iii) Windows .hlp files.  [Only available if building from sources.]
Set this as the default by options(winhelp=TRUE) or for individual
help items by help(topic, winhelp=TRUE).  Full text search is
available from the Search tab.  The conversion to this format is a
little rough, and tables may be incomplete.  The help on Hershey and
Japanese fonts has been omitted.



Customization
=============

Environment variables can be set as NAME=value at the end of the
command line, including in a shortcut.  They can also be set (as
NAME=value lines) in the file .Renviron in the working directory, or
if that does not exist HOME\.Renviron.

Many aspects of the console (size, appearance, font, font size,
colours) can be customized by editing the file etc\Rconsole, and a
copy with a user's settings can be put in her HOME directory or in the
working directory.  (The exact sequence is to search the directory
pointed to by the first found of the environment variables R_USER then
HOME then {HOMEDRIVE}{HOMEPATH} then the working directory, finally
R_HOME\etc.  This also applies to .Renviron and other uses of `HOME'
in our documentation.)  The file contains a description of the
settings that can be altered.  See also ?Rconsole.

An alternative way to edit the Rconsole file is to use the GUI
preferences item on the Edit menu in Rgui.exe.  This can change some
of the settings (for example colours, font and window sizes) on the
current running console.

The mapping between Windows fonts and the font number used in R's
graphics can be set by editing the file etc\Rdevga, and a copy with a
user's settings can be put in the HOME or working directory (see the
description of Rconsole).  This mapping applies to both the screen
device and the printer device.

Many R defaults can be set in the file R_HOME\etc\Rprofile or a user's
file .Rprofile.  In particular:

- The pager is set by options(pager=).  The default is "internal" which
  brings up a separate console-like window.  The internal pager can use
  a single window or a different window for each topic shown
  (configurable in Rconsole).  Other possibilities we have
  used are "notepad" and "pfe32 /v", and "console" to list the files in
  the console (Rgui.exe) or terminal window (Rterm.exe).


Adding packages
===============

Binaries for many packages are available at CRAN/bin/windows/contrib.
These are zip files which should be unpacked in @RWVER@\library.
Perhaps the simplest option is use the items on the Packages menu to
install from a zip file or to download from CRAN.

The list of packages and functions given by HTML help and used by the
search engine can be updated from a running R process by the command

	link.html.help()

provided the owner of the process has write permission on
@RWVER@\doc\html.  If you have the source-package files and Perl
installed you can (and should in preference) use

	cd ...\@RWVER@\src\gnuwin32\help
	make indices

Private libraries of packages can be used and can be specified by the
environment variable R_LIBS.  (Separate directories by ";" in this
version.)  They will not be linked to HTML help.  In more detail, to
use packages installed in directory R:\libraries\gm, set

R_LIBS=R:\libraries\gm

in the environment or your .Renviron file or on the command line, or
add the line

.lib.loc <- c("R:/libraries/gm", .lib.loc)

to your .Rprofile or at the end of R_HOME\etc\Rprofile.

To install a package from source code you need the source-package
distribution @RWVER@sp.zip installed (but not the R sources).  This
contains detailed instructions.


Differences from Unix versions of R
===================================

- R can be interrupted by Esc in Rgui and by Ctrl-C or Ctrl-Break in Rterm:
  Ctrl-C is used for copying in the GUI version.  C-c C-c works
  under NTemacs.

- Command-line editing is always available, but is simpler than
  under readline-based input on Unix.  For Rgui.exe, see the menu item
  `Help | Console', for Rterm.exe the file README.Rterm.

- The HTML function and package lists and search database are not
  re-generated automatically by help.start().  Use link.html.help().

- Paths to files can be specified with "/" or "\\".

- Using help.start() does not automatically send help requests to the
  browser: use options(htmlhelp=T) to turn this on.

- system() is enhanced here and does not automatically use a shell.
  See its help page and that of shell().

- graphics device bmp() is available in this version.


Using package tcltk
===================

The package tcltk introduced in version 1.1.0 provides somewhat
experimental support for building graphical interfaces with Tcl/Tk.
To use this you need to install either ActiveTcl 8.3.3 from
http://aspn.activestate.com/ASPN/Downloads/ActiveTcl/ or tcl832.exe
from dev.scriptics.com, and you will need the Tcl and Tk dlls in your path.
Also, you need to set the environment variable TCL_LIBRARY, to
something like c:/Program Files/Tcl/lib/tcl8.3.

How you set environmental variables under Windows is system-dependent,
but with R you can always use the form
TCL_LIBRARY="c:/Program Files/Tcl/lib/tcl8.3"
at the end of the command line or Target field of a shortcut.

The demos(tk*) (available after loading the tcltk library) will work
on Windows.


Building From Source
====================

See the file @RVER@\src\gnuwin32\INSTALL in the source distribution
and the rw-FAQ.


Feedback
========

Please send comments and bug reports to (preferably both of)

    Guido Masarotto <guido@hal.stat.unipd.it>
    Brian Ripley <ripley@stats.ox.ac.uk>
