Blame | Last modification | View Log | Download | RSS feed
Frequently Asked Questions for R for Windows 0.64.x===================================================This FAQ is for the Windows port of R: it describes features specificto that version. The main R FAQ can be found athttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.htmlThere are two versions of R for Windows, but only is under activedevelopment, that described here. It is often called something likerw0640 (although not officially).1) Installation and Usage=========================1.1) Where can I find the latest version?Go to any CRAN site (see http://www.ci.tuwien.ac.at/R/mirrors.htmlfor a list), navigate to the bin/windows/windows-NT/base directory andcollect the files you need. You will need at least the filesrw064?b.zip rw064?h.zipand will probably want rw064?w.zip (the HTML format help files).1.2) How do I install R for Windows?First, you need Windows 95 or 98 or NT4 (or possibly earlier): Windows3.11+win32s will not work. Your file system must allow long file names(as is likely except perhaps for some network-mounted systems).Choose a location and unzip the zip files (with a tool thatpreserves long file names and the directory structure: we recommendthe INFO-ZIP project's unzip). All the files will unpack into adirectory called rw06xx, for some `xx'.Choosing a working directory for R. Make a shortcut torw06xx\bin\Rgui.exe on your desktop or somewhere on the Start filetree. Right-click the shortcut, select Properties... and change the`Start in' field to your working directory.You may also want to add command-line arguments at the end of theTarget field. We use --vsize 10M --nsize 250000. (For rw0632 or earlier,use 10 rather than 10M.)1.3) How do I run it?Just double-click on the shortcut you prepared at installation.If you want to set up another project, make a new shortcut or use theexisting one, and change the `Start in' field of the Properties.1.4) I am using Windows NT and I get a GPF when I try to start rgui.exeor rterm.exe for the command line.This happened prior to rw0633. Try giving the full path to theexecutable when you start it up. We know this will not work with theCygwin bash shell unless the Cygwin and Windows path names are thesame.We believe this is completely solved in rw0633 and later: please upgrade.1.5) How can I manage my work keeping workspaces for different projectsin different directories?Create a separate shortcut for each project: see Q1.3. All the paths tofiles used by R are relative to the starting directory, so setting the`Start in' field automatically helps separate projects.1.6) How do I print from R?It depends what you want to print.-- You can print the graphics window from its menu or by using dev.print().-- The way to print from the R console is to select the text you want,copy it (from the Edit menu or via Ctrl-C) and paste it into aneditor (e.g. notepad) and print from there.-- You can print help files from the HTML browser.-- If you have configured RHOME/bin/helpPRINT.bat and have latex installedyou can print help files by help(fn_name, offline=T).1.7) Can I use R BATCH?No, but you can set up a batch file using rterm.exe. A sample batchfile might contain (as one line)path_to_R\bin\rterm.exe --vsize 10M --nsize 250k --no-restore--no-save %1 > %1.out1.8) Can I use rw0xx with ESS and emacs?Yes. Some time soon versions of ESS (5.1.3 had a `somewhat rough'prototype for rw0632) will come with support for this version of R. Ifyours does not, edit essd-r.el to have(inferior-ess-start-args . "--ess"))and make sure you give the full path to Rterm.exe as the R executable.(You can add other flags like --vsize 10M after -ess.)2) Packages===========2.1) Can I install packages (libraries) in this version?Yes, of course. The easy way is to see if a pre-compiled binaryversion of the package is available: look on CRAN atbin/windows/windows-NT/contrib. If there is, download the zip file andunpack it in the rw06xx\library directory, using unzip or similar.If there is not a binary version or that is not up-to-date or you prefercompiling from source, get rw06xxsp.zip from the distribution (see Q1.1)and unpack it in rw06xx. Then cd src\gnuwin32 and readREADME.packages. You will need to collect and install several toolsto use this. Once you have done so, installation is easy: just run`make pkg-pkgname'.2.2) I don't have permission to write to the rw06xx\library directory.Is this fatal?You can install packages anywhere and use the environment variableRLIBS to point to the library location(s). You can also set the R variable`.lib.loc' in your .Rprofile or when running R.Suppose your packages are in installed in p:\mylibs. Then you can EITHERset RLIBS to p:\mylibsOR put in the .Rprofile in the working directory or your home directory.lib.loc <- c("p:/mylibs", .Library)OR use a package by, e.g.library(MASS, lib.loc="p:/mylibs")How you set an environment variable is system specific: in 9x you canset them in autoexec.bat or in an MS-DOS window from which you launchRgui/Rterm. Under NT you can use the control panel.You can also build packages anywhere, but that is much trickier: it issimpler to install a private copy of R to do the building.2.3) The packages I installed do not appear in the HTML help system.HTML help only works for packages installed in rw06xx\library.(Information for rw0633 or later) To update the HTML help files afteryou have installed a binary package, run> link.html.help()at the R prompt. (The source-code installation does thisautomatically, and if you have that installed you can use (preferably)cd rw06xx\src\gnuwin32\helpmake indicesinstead.)2.4) The functions in the packages I installed are not found by theHTML help search system.The following conditions need to hold:-- the package is installed in rw06xx\library.-- you are using rw0633 or later.-- the package contains a CONTENTS file in top-level directory (most of thebinary distributions do not).-- you updated the indices as described in the answer to Q2.2 afterinstalling the package.If those all hold true, this works for us.3) Windows Features===================3.1) What should I expect to behave differently from the Unix/GNU-Linuxversion of R?- R commands can be interrupted by Esc in rgui.exe and Ctrl-break inrterm.exe: Ctrl-C is used for copying in the GUI version.- Command-line editing is always available, but is much simplerthan the readline-based editing on Unix. For rgui.exe,the menu item `Help | Console' will give details.- The commands history is saved between sessions only on rgui.exe,and it is always saved.- Using help.start() does not automatically send help requests to thebrowser: use options(htmlhelp=T) to turn this on.- The HTML help system can only access packages installed in thestandard place.- Paths to files (e.g. in source()) can be specified with either "/" or "\\".- system() is slightly different: see its help page.3.2) I hear about some nifty features: please tell me about them!You have read the README? There are file menus on both the R consoleand on graphics windows. You can source and save from those menus,and copy the graphics to gif, postscript or metafile. The graphics hasa history mechanism. As the README says:`The History menu allows the recording of plots. When plots have beenrecorded they can be reviewed by PgUp and PgDn, saved and replaced.Recording can be turned on automatically (the Recording item on thelist) or individual plots can be added (Add or the INS key). Thewhole plot history can be saved to or retrieved from an R variable inthe global environment.There is only one graphics history shared by all the x11 devices.'The R console and graphics windows have configuration files stored inthe RHOME\etc directory called Rconsole and (rw0633 and later) Rdevga;you can keep personal copies in your HOME directory. They containcomments which should suffice for you to edit them to yourpreferences. For more details see ?Rconsole.4) Workspaces=============4.1) My workspace gets saved in a strange place: how do I stop this?Have you changed the working directory?: see Q4.2.Prior to rw0633, using the file dialog boxes from the menus tonavigate the file system changes the working directory. Either don'tuse them, or use the `Source file' menu item and navigate back towhere you want the workspace (.RData) saved before quitting Rgui.4.2) How do I store my workspace in a different place?Use the `File | Change' Dir menu item to select a new working directory:this defaults to the last directory you loaded a file from. Theworkspace is saved in the working directory.4.3) Can I load workspaces saved under Unix/GNU-Linux?Yes, on rw0633 or later.5) The R Console and Fonts==========================5.1) I would like to be able to use Japanese fonts in the console andto annotate graphs.We believe this is possible by setting suitable fonts in the Rconsoleand Rdevga configuration files (see Q3.2). You can specify additionalfonts in Rdevga, and use them by par(font=, font.lab=, font.main=,font.sub=). Nineteen fonts are specified (as 1 to 19) by default: youcan add to these (up to 13 more) or replace them.5.2) I don't see characters with accents at the R console, for examplein ?text.You need to specify a font in Rconsole (see Q3.2) that supports latin1encoding. The default, Courier New, does on our systems, as doesFixedSys. This may be a problem in other locales, especially fornon-Western European languages.5.3) When using Rgui, the output to the console seems to be delayed.This is deliberate: the console output is buffered and re-written inchunks to be less distracting. You can turn buffering off or on from theMisc menu: Ctrl-W toggles the setting.If you are sourcing R code or writing from a function, there isanother option. A call to the R function flush.console() will writeout the buffer.6) Building from Source=======================6.1) Can I compile R from source?Get the R sources and the corresponding file rw06xxs.zip from thedistribution (see Q1.1). Suppose you want to compile R-0.64.0.tar zxvf R-0.64.0.tgz (ignore warnings about aux)cd R-0.64.0unzip ...\rw0640scd src\gnuwin32Now read the README and set up all the tools needed. Then you can justuse `make', sit back and wait. (A complete build takes about 15minutes on a 300MHz PII with a fast local disc.) To keep only thehelp files in zip files, usemake ziponly-baseYou do need to compile under a case-honouring file system: we foundthat a samba-mounted file system (which maps all file names to lower case)did not work.6.2) How do I debug code that I have compiled and dyn.load-ed?To be written.Brian Ripley <ripley@stats.ox.ac.uk>Guido Masarotto <guido@hal.stat.unipd.it>