R-beta: R-FAQ v0.1-0

Kurt Hornik Kurt.Hornik at ci.tuwien.ac.at
Wed Apr 23 17:13:22 CEST 1997


A much updated R FAQ is now available at the URL

	http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html

The plain text version is appended below.

-k

*****************************************************************************
*          Kurt Hornik         *                                            *
*  Dept of Statistics TU Wien  * tel:    +43 (1) 58801-4542                 *
*  Wiedner Hauptstr 8-10/1071  * fax:    +43 (1) 504-1498                   *
*          A-1040 Wien         * email:  Kurt.Hornik at ci.tuwien.ac.at        *
*            Austria           * WWW:    http://www.ci.tuwien.ac.at/~hornik *
*****************************************************************************

*****************************************************************************
  R FAQ
  Kurt Hornik
  v0.1-0, 1997/04/23

  This document contains answers to some of the most frequently asked
  questions about R.  Feedback is welcome.
  ______________________________________________________________________

  Table of Contents:

  1. Introduction

     1.1 Legalese
     1.2 Obtaining this Document
     1.3 Notation
     1.4 Feedback

  2. R Basics

     2.1 What Is R?
     2.2 What Machines Does R Run on?
     2.3 What Is the Current Version of R?
     2.4 How Can R Be Obtained?
     2.5 How Can R Be Installed?
        2.5.1 How Can R Be Installed (Unix)
        2.5.2 How Can R Be Installed (Windows)
        2.5.3 How Can R Be Installed (Macintosh)
     2.6 Are there Unix Binaries for R?
     2.7 Which Documentation Exists for R?
     2.8 Which Mailing Lists Exist for R?
     2.9 What is CRAN?

  3. R and S

     3.1 What Is S?
     3.2 What Is S-PLUS?
     3.3 What Are the Differences between R and S?

  4. R Add-On Packages

     4.1 Which Add-on Packages Exist for R?
     4.2 How Can Add-on Packages Be Installed?
     4.3 How Can Add-on Packages Be Used?
     4.4 How Can I Contribute to R?

  5. R and Emacs

     5.1 Is there Emacs Support for R?
     5.2 Should I Run R from Within Emacs?

  6. R Miscellania

     6.1 How Can I Read a Large Data Set into R?
     6.2 Why Can't R Source a `Correct' File?
     6.3 How Can I Set Components of a List to NULL?
     6.4 How Can I Save My Workspace?
     6.5 How Can I Clean Up My Workspace?

  7. Acknowledgments

  ______________________________________________________________________

  11..

  This document contains answers to some of the most frequently asked
  questions about R.

  11..11..

  This document is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  If you do not have a copy of the GNU General Public License, write to
  the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.

  11..22..

  The latest version of this document is always available from
  http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html.

  From there, you can also obtain versions converted to plain ASCII
  text, GNU info, DVI, and PostScript, as well as the SGML source used
  for creating all these formats using the SGML-Tools (formerly
  Linuxdoc-SGML) system.  (Note that right now cross-references don't
  work in the translation to plain ASCII.)

  11..33..

  Everything should be pretty standard.  `R>' is used for the R prompt,
  and a `$' for the shell prompt (where applicable).

  11..44..

  Feedback is of course most welcome.

  In particular, note that I do not have access to Windows or Mac
  systems.  If you have information on these systems that you think
  should be added to this document, please let me know.

  22..

  22..11..

  R is a system for statistical computation and graphics.  It consists
  of a language plus a run-time environment with graphics, a debugger,
  access to certain system functions, and the ability to run programs
  stored in script files.

  The design of R has been heavily influenced by two existing languages:
  Becker, Chambers & Wilks' S (see question ``What is S?'') and
  Sussman's Scheme.  Whereas the resulting language is very similar in
  appearance to S, the underlying implementation and semantics are
  derived from Scheme.  See question ``What Are the Differences between
  R and S?'' for a discussion of the differences between R and S.

  R is being developed by Ross Ihaka and Robert Gentleman, who are
  Senior Lecturers at the Department of Statistics of the University of
  Auckland in Auckland, New Zealand.

  R is free software distributed under a GNU-style copyleft.

  22..22..  WWhhaatt MMaacchhiinneess DDooeess RR RRuunn oonn??

  R is being developed for the Unix, Windows and Mac platforms.

  R will configure and build under a number of common Unix platforms
  including dec-alpha-osf, freebsd, hpux, linux-elf, sgi-irix, solaris,
  and sunos.  If you know about other platforms, please drop me a note.

  22..33..  WWhhaatt IIss tthhee CCuurrrreenntt VVeerrssiioonn ooff RR??

  The current Unix version is 0.49, the previous one was 0.16.1.  The
  jump in the version number reflects the fact that this version
  represents quite a jump towards what is hoped to be in the eventual
  1.0 release.  (However, it fell a little short of what was wanted for
  0.50.)  Version 0.49 added group methods and complex numbers, and
  hence more or less provides a full implementation of S as described in
  ``The New S Language''.

  The versions for Windows and Mac are pre-alpha.  With some good luck,
  the Windows version will soon catch up with the Unix version.

  22..44..

  Sources, binaries and documentation for R can be obtained via CRAN,
  the ``Comprehensive R Archive Network'' (see question ``What is
  CRAN?'').

  22..55..  HHooww CCaann RR BBee IInnssttaalllleedd??

  22..55..11..

  If binaries are available for your platform (see question ``Are there
  Unix Binaries for R?''), you can use these, following the instructions
  that come with them.

  Otherwise, you can compile and install R yourself, which can be done
  very easily under a number of common Unix platforms (see question
  ``What Machines Does R Run on?'').  The file INSTALL that comes with
  the R distribution contains instructions.

  Choose a place to install the R tree (R is not just a binary, but has
  additional data sets, help files, font metrics etc).  Let's call this
  place RHOME (given appropriate permissions, a natural choice would be
  `/usr/local/lib/R').  Untar the source code, and issue the following
  commands (at the shell prompt):

       $ ./configure
       $ make
       $ make install-help

  You can also build a LaTeX version of the manual entries with

       $ make install-latex

  and an HTML version of the manual with

       $ make install-html

  If these commands execute successfully, the R binary will be copied to
  the `$RHOME/bin' directory.  In addition, a shell script font-end
  called `R' will be created and copied to the same directory.  You can
  copy this script to a place where users can invoke it, for example to
  `/usr/local/bin'.  You could also copy the man page `R.1' to a place
  where your man reader finds it, such as `/usr/local/man/man1'.

  22..55..22..

  Get the file `Rexe.zip' from the `bin/ms-windows' directory of a CRAN
  site.  This archive contains a binary Windows 3.xx distribution for R
  and installation instructions.

  Robert Gentleman has recently made an updated pre-alpha Windows
  executable file available for ftp at
  ftp://stat.auckland.ac.nz/pub/research/rgentlem/rbeta.zip.  This
  binary should be more compatible with Windows 95 than the other (he
  does not know about 3.1).  You still need all the other extra files
  from the previous Windows distribution, it is only an executable.

  22..55..33..

  CRAN sites have a directory `bin/macintosh' which contains
  `R.sea.hqx', a binhexed self-extracting archive, and installation
  instructions in `README.MACINTOSH'.

  22..66..  AArree tthheerree UUnniixx BBiinnaarriieess ffoorr RR??

  Experimental `.deb' packages for installation under Debian GNU/Linux
  can be found in `bin/ix86-linux'.  No other binaries distributions for
  Unix systems have thus far been made publically available.

  22..77..  WWhhiicchh DDooccuummeennttaattiioonn EExxiissttss ffoorr RR??

  Currently, there is no R manual.  Online documentation for most of the
  functions and variables in R exists, and can be printed on-screen by
  typing help(_n_a_m_e) (or ?_n_a_m_e) at the R prompt, where _n_a_m_e is the name
  of the R object help is sought for.  (In the case of unary and binary
  operators and control-flow special forms, the name may need to be be
  quoted.)

  This documentation can also be made available as HTML, and as hardcopy
  via LaTeX, see question ``How Can R Be Installed?''.  An up-to-date
  HTML version is always available for web browsing at

       http://www.stat.math.ethz.ch/R-manual

  In the absence of a systematic introduction to R, one can mostly get
  along with introductions to S or S-PLUS, such as ``Notes on S-PLUS:  A
  Programming Environment for Data Analysis and Graphics'' by Bill
  Venables <venables at stats.adelaide.edu.au> and David Smith
  <D.M.Smith at lancaster.ac.uk>.  This document talks mostly about plain S
  features, and does not concentrate on features specific to S-PLUS, and
  is available from the Statlib S repository at
  http://lib.stat.cmu.edu/S/SplusNotes/ (LaTeX source and PostScript).
  An introduction to R based on it will soon be available.

  Last, but not least, Ross' and Robert's experience in designing and
  implementing R is described in:

       @Article{,
         author =       {Ross Ihaka and Robert Gentleman},
         title =        {R: A Language for Data Analysis and Graphics},
         journal =      {Journal of Computational and Graphical Statistics},
         year =         1996,
         volume =       5,
         number =       3,
         pages =        {299--314}
       }

  This is also the reference for R to use in publications.

  22..88..

  Thanks to Martin Maechler <maechler at stat.math.ethz.ch>, there are
  three mailing lists devoted to R.

     rr--aannnnoouunnccee
        This list is for announcements about the development of R and
        the availability of new code.

     rr--ddeevveell
        This list is for discussions about the future of R and pre-
        testing of new versions.  It is meant for those who maintain an
        active position in the development of R.

     rr--hheellpp
        The `main' R mailing list, for announcements about the
        development of R and the availability of new code, questions and
        answers about problems and solutions using R, enhancements and
        patches to the source code and documentation of R, comparison
        and compatibility with S and S-plus, and for the posting of nice
        examples and, benchmarks.

  To send a message to everyone on the r-help mailing list, send email
  to

       r-help at stat.math.ethz.ch

  To subscribe (or unsubscribe) to this list send subscribe (or unsub-
  scribe) in the BODY of the message (not in the subject!)  to r-help-
  request at stat.math.ethz.ch.  Information about the list can be obtained
  by sending an email with info as its contens to r-help-
  request at stat.math.ethz.ch.

  Subscription and posting to the other lists is done analogously, with
  `r-help' replaced by `r-announce' and `r-devel', respectively.  Note
  that the r-announce list is gatewayed into r-help, so you don't need
  to subscribe to both of them.

  It is recommended that you send mail to r-help rather than only to the
  R developers (who are also subscribed to the list, of course).  This
  may save them precious time they can use for constantly improving R,
  and will typically also result in much quicker feedback for yourself.

  Of course, in the case of bug reports it would be very helpful to have
  code which reliably reproduces the problem.

  22..99..  WWhhaatt iiss CCRRAANN??

  The ``Comprehensive R Archive Network'' (CRAN) is a collection of
  sites which carry identical material, consisting of the R
  distribution(s), the contributed extensions, documentation for R, and
  binaries.

  The CRAN master site can be found at the URL

       ftp://ftp.ci.tuwien.ac.at/pub/R/

  and is currently being mirrored daily at

       http://lib.stat.cmu.edu/R/CRAN/
       ftp://franz.stat.wisc.edu/pub/R/
       ftp://ftp.stat.math.ethz.ch/R-CRAN/

  Please use the CRAN site closest to you to reduce network load.

  The structure of the CRAN tree is as follows.

     ``src/base'
        contains the official R distribution as provided by Ross Ihaka
        and Robert Gentleman.

     ``src/contrib'
        contains code for extension packages.

     ``doc'
        is for additional documentation and information on R.
     ``bin'
        is for prebuilt R binaries (the base distribution and
        extensions), grouped according to platforms.  Currently, there
        are only experimental packages for Debian GNU/Linux.  I hope
        that `.tar.gz' files with contents relative to an installation
        tree (e.g. `bin', `lib/R/', and `man/man1/R.1') can be made
        available soon for all major supported Unix platforms.

  The process of ``submitting'' to CRAN currently is very simple: upload
  to ftp://ftp.ci.tuwien.ac.at/incoming and send email to Kurt Hornik
  <Kurt.Hornik at ci.tuwien.ac.at>.  Please indicate the copyright
  situation (GPL, ...) in your submission.

  33..

  33..11..  WWhhaatt IIss SS??

  S is a very high level language and an environment for data analysis
  and graphics.  S was written by Richard A. Becker, John M. Chambers,
  and Allan R. Wilks of AT&T Bell Laboratories Statistics Research
  Department.

  The primary references for S are two books by the creators of S.

  +o  Richard A. Becker, John M. Chambers and Allan R. Wilks (1988),
     ``The New S Language,'' Chapman & Hall, London.

     This book is often called the ``_B_l_u_e _B_o_o_k''.

  +o  John M. Chambers and Trevor J. Hastie (1992), ``Statistical Models
     in S,'' Chapman & Hall, London.

     This is also called the ``_W_h_i_t_e _B_o_o_k''.

  There is a huge amount of user-contributed code for S, available at
  the S Repository at CMU.

  See the ``Frequently Asked Questions about S''
  (http://lib.stat.cmu.edu/S/faq) for further information about S.

  33..22..  WWhhaatt IIss SS--PPLLUUSS??

  S-PLUS is a value-added version of S sold by Statistical Sciences,
  Inc. (now a division of Mathsoft, Inc.)  S is a subset of S-PLUS, and
  hence anything which may be done in S may be done in S-PLUS.  In
  addition S-PLUS has extended functionality in a wide variety areas,
  including robust regression, modern nonparametric regression, time
  series, survival analysis, multivariate analysis, classical
  statistical tests, quality control, and graphics drivers.  Add-on
  modules add additional capabilities for wavelet analysis, spatial
  statistics, and design of experiments.

  See the MathSoft S-PLUS page (http://www.mathsoft.com/splus.html) for
  further information.

  33..33..  WWhhaatt AArree tthhee DDiiffffeerreenncceess bbeettwweeeenn RR aanndd SS??

  Whereas the developers of R have tried to stick to the S language as
  defined in ``The New S Language'' (Blue Book, see question ``What is
  S?''), they have adopted the evaluation model of Scheme.

  This difference becomes manifest when _f_r_e_e variables occur in a
  function.  Free variables are those which are neither formal
  parameters (occurring in the argument list of the function) nor local
  variables (created by assigning to them in the body of the function).
  Whereas S (like C) by default uses _s_t_a_t_i_c scoping, R (like Scheme) has
  adopted _l_e_x_i_c_a_l scoping.  This means the values of free variables are
  determined by a set of global variables in S, but in R by the bindings
  that were in effect at the time the function was created.

  Consider the following function:

       cube <- function(n) {
         sq <- function() n * n
         n * sq()
       }

  Under S, sq() does not ``know'' about the variable n unless it is
  defined globally:

       S> cube(2)
       Error in sq():  Object "n" not found
       Dumped
       S> n <- 3
       S> cube(2)
       [1] 18

  In R, the ``environment'' created when cube() was invoked is also
  looked in:

       R> cube(2)
       [1] 8

  Lexical scoping allows using function closures and maintaining local
  state.  A simple example (taken from Abelson and Sussman) can be found
  in the `demos/language' subdirectory of the R distribution.  Further
  information is provided in the standard R reference ``R: A Language
  for Data Analysis and Graphics'' (see question ``Which Documentation
  Exists for R?'') and a paper on ``Lexical Scope and Statistical
  Computing'' by Robert Gentleman and Ross Ihaka which can be obtained
  from the `doc/misc' directory of a CRAN site.

  Lexical scoping also implies a further major difference.  Whereas S
  stores all objects as separate files in a directory somewhere (usually
  `.Data' under the current directory), R does not.  All objects in R
  are stored internally.  When R is started up it grabs a very large
  piece of memory and uses it to store the objects.  R performs its own
  memory management of this piece of memory.  Having everything in
  memory is necessary because it is not really possible to externally
  maintain all relevant ``environments'' of symbol/value pairs.  This
  difference also seems to make R _m_u_c_h _f_a_s_t_e_r than S.
  The down side is that if R crashes you will lose all the work for the
  current session.  Saving and restoring the memory ``images'' (the
  functions and data stored in R's internal memory at any time) can be a
  bit slow, especially if they are big.  In S this does not happen,
  because everything is saved in disk files and if you crash nothing is
  likely to happen to them.  R is still in an alpha stage, and does
  crash from time to time.  Hence, for important work you should
  consider saving often, see question ``How Can I Save My Workspace?''
  (other possibilities are logging your sessions, or have your R
  commands stored in text files which can be read in using source()).
  (Note that if you run R from within Emacs (see question ``R and
  Emacs''), you can save the contents of the interaction buffer to a
  file and conveniently manipulate it using S-transcript-mode, as well
  as save source copies of all functions and data used.)

  Apart from lexical scoping and its implications, R follows the S
  language definition in the Blue Book as much as possible, and hence
  really is an ``implementation'' of S.  There are some intentional
  differences where the behavior of S is considered ``not clean''.  In
  general, the rationale is that R should help you detect programming
  errors, while at the same time being as compatible as possible with S.

  Some known differences are the following.

  +o  In R, if x is a list, then x[sub] <- NULL and x[[sub]] <- NULL
     remove the specified elements from x.  The first of these is
     incompatible with S, where it is a no-op.

  +o  In S, the functions named .First and .Last in the `.Data' directory
     can be used for customizing, as they are executed at the very
     beginning and end of a session, respectively.  R looks for files
     called `.Rprofile' in the user's home directory and the current
     directory, and sources these.  (It also loads a saved image from
     `.RData' in case there is one.)  If a .First function exists then,
     it is executed.  The .Last mechanism is not supported yet.

  +o  Attaching library sections works differently.  In S, library(_n_a_m_e)
     adds the data directory for the library section _n_a_m_e to the search
     list.  If a function object named `.First.lib' exists in the
     directory, it is executed; this is typically used to dynamically
     load compiled code required by the functions in the section.  In R,
     library(_n_a_m_e) currently simply sources the file
     $RHOME/library/_n_a_m_e, and compiled code can be loaded by calling
     library.dynam() in this file.  The .First.lib mechanism is not
     really supported.  (Note that a library file is only loaded once,
     so that any code in the library that is not in a function is
     executed the first time the library is loaded.)

  +o  R does not try as hard as S to preserve dimnames attributes
     (examples are apply, rbind, and cbind, but also arithmetic ops).

  +o  R presently does not support IEEE Inf and NaN.

  +o  In R, attach currently only works for lists and data frames (not
     for directories).

  +o  Categories do not exist in R, and never will as they are deprecated
     now in S.  Use factors instead.

  +o  In R, For() loops are not necessary and hence not supported.

  +o  In R, assign() uses the argument envir= rather than where= as in S.

  +o  The random number generators are different, and the seeds have
     different length.

  +o  The glm family objects are implemented differently in R and S.  The
     same functionality is available but the components have different
     names.

  +o  terms objects are stored differently.  In S a terms object is an
     expression with attributes, in R it is a formula with attributes.
     The attributes have the same names but are mostly stored
     differently.  The major difference in functionality is that a terms
     object is subscriptable in S but not in R.  If you can't imagine
     why this would matter then you don't need to know.

  There are also differences which are not intentional, and result from
  missing or incorrect code in R.  The developers would appreciate
  hearing about any deficiencies you may find (in a written report fully
  documenting the difference as you see it).  Of course, it would be
  useful if you were to implement the change yourself and make sure it
  works.

  44..

  44..11..

  The R distribution comes with the following extra libraries:

     eeddaa
        Exploratory Data Analysis.  Currently only contains functions
        for robust line fitting, and median polish and smoothing.

     mmvvaa
        Multivariate Analysis.  Currently contains code for principal
        components (prcomp), canonical correlations (cancor),
        hierarchichal clustering (hclust), and metric multidimensional
        scaling (cmdscale).  More functions for clustering and scaling,
        biplots, profile and star plots, and code for ``real''
        discriminant analysis will be added soon.

  The following packages are available from the CRAN `src/contrib' area.

     aacceeppaacckk
        ace (Alternating Conditional Expectations) and avas (Additivity
        and VAriance Stabilization for regression) for selecting
        regression transformations.

     bboooottssttrraapp
        Software (bootstrap, cross-validation, jackknife), data and
        errata for the book ``An Introduction to the Bootstrap'' by B.
        Efron and R. Tibshirani, 1993, Chapman and Hall.

     cctteesstt
        A library of classical tests, including the Bartlett, Fisher,
        Kruskal-Wallis, Kolmogorov-Smirnov, and Wilcoxon tests.

     ddaattee
        Functions for dealing with dates.  The most useful of them
        accepts a vector of input dates in any of the forms 8/30/53,
        30Aug53, 30 August 1953, ..., August 30 53, or any mixture of
        these.

     ee11007711
        Miscellaneous functions used at the Department of Statistics at
        TU Wien (E1071).

     ffrraaccddiiffff
        Maximum likelihood estimation of the parameters of a
        fractionally differenced ARIMA(p,d,q) model (Haslett and
        Raftery, Applied Statistics, 1989).

     ggeeee
        An implementation of the Liang/Zeger generalized estimating
        equation approach to GLMs for dependent data.

     jjppnn
        A function to plot Japan's coast-line and prefecture boundaries.

     oozz Functions for plotting Australia's coastline and state
        boundaries.

     ssnnnnss
        An R interface to the Stuttgart Neural Networks Simulator
        (SNNS).

     sspplliinneess
        Regression spline functions.

     ssuurrvviivvaall44
        Functions for survival analysis (requires sspplliinneess).

  See CRAN `src/contrib/INDEX' for more information.

  Paul Gilbert <pgilbert at bank-banque-canada.ca> has a written a
  multivariate time series library for S called ttiimmee..sseerriieess that is
  mostly converted to run in R.  He will make this port generally
  available when complex numbers are implemented (see question ``What is
  the current version of R?'').

  According to Paul, the PADI interface from the Bank of Canada also
  works with minor changes.  PADI can be used to access Fame time series
  data bases and potentially other databases, even remotely over the
  Internet.  For further information see http://www.bank-banque-
  canada.ca/pgilbert.

  According to Arne Kovac <A.Kovac at Bristol.ac.uk>, Guy Nason's
  WaveThresh package for S worked with only minor modifications under R
  version 0.12.

  More code has been posted to the r-help mailing list, and can be
  obtained from the mailing list archive.

  44..22..

  (Unix only.)  Untar the add-on packages in $RHOME/src/library/ and
  type

       $ make libs
       $ cd ../..
       $ ./etc/install-libhelp

  at the shell prompt.

  44..33..

  To find out which add-ons have already been installed, type

       R> library()

  at the R prompt.  This produces something like

       NAME         DESCRIPTION
       acepack      ace() and avas() for selecting regression transformations
       bootstrap    Functions for the book "An Introduction to the Bootstrap"
       ctest        Classical Tests
       date         Functions for handling dates
       eda          Exploratory Data Analysis
       fracdiff     Fractionally differenced ARIMA (p,d,q) models
       gee          Generalized Estimating Equation models
       mva          Classical Multivariate Analysis
       splines      Regression spline functions
       survival4    Survival analysis [needs library(splines)]

  You can ``load'' an add-on with name _n_a_m_e by

       R> library(_n_a_m_e)

  You can then find out which functions it provides by typing

       R> help(library = _n_a_m_e)

  44..44..

  R is currently still in alpha (or pre-alpha) state, so simply using it
  and communicating problems is certainly of great value.

  One place where functionality is still missing is the modeling
  software as described in ``Statistical Models in S'' (see question
  ``What is S?''.  The functions

        add1 kappa alias labels drop1 proj

  are missing; many of these are interpreted functions so anyone that is
  bored and wants to have a go at implementing them it would be appreci-
  ated.  In addition, only linear and generalized linear models are cur-
  rently available, aov, gam, loess, tree, and the nonlinear modelling
  code are not there yet.

  Many of the packages available at the Statlib S Repository might be
  worth porting to R.

  If you are interested in working on any of these projects, please
  notify Kurt Hornik.

  55..  RR aanndd EEmmaaccss

  55..11..  IIss tthheerree EEmmaaccss SSuuppppoorrtt ffoorr RR??

  There is an Emacs-Lisp interface to S/S-PLUS called S-mode.  Its
  current version is 4.8 and can be obtained at
  http://www.maths.lancs.ac.uk:2080/~maa036/elisp/S-mode/.  The earlier
  versions which can be found at the Statlib S repository (gnuemacs3 and
  gnuemacs4) are outdated.

  It contains code for interacting with an inferior S process from
  within Emacs including an interface to the help system, editing S
  source code, and transcript manipulation, and comes with detailed
  instructions for installation.

  Martin Maechler <maechler at stat.math.ethz.ch> and Tony Rossini
  <rossini at math.sc.edu> have integrated support for R into this package.
  The current version is at

       ftp://ftp.math.sc.edu/rossini/S-mode-4.8.MM6.XE2.tar.gz

  and runs under both GNU Emacs and XEmacs.

  To install, put the byte-compiled `.el' files into a place where Emacs
  can find them, and add

       (if (not (assoc "\\.R$" auto-mode-alist)
           (add-to-list 'auto-mode-alist (cons "\\.R$" 'R-mode))))
       (autoload 'R "S" "Run an inferior R process" t)
       (autoload 'R-mode "S" "Mode for editing R source" t)
       (autoload 'r-mode "S" "Mode for editing R source" t)

  to one of your Emacs startup files, typically `~/.emacs'.  You can
  then fire up R from within Emacs by typing `M-x R' (note however that
  many interface functions will not work), and if you use the extension
  `.R' for your files with R code, Emacs will automagically turn on R
  edit mode whenever you visit such a file.

  Tony Rossini, Martin Maechler and Kurt Hornik have officially taken
  over the development of S-mode.  Version 4.9 (based on the current
  4.8.MM series) will be released shortly;  version 5.0 (codenamed
  ``istat'') should be out by the end of 1997.

  55..22..

  Yes.  Inferior R mode provides a readline/history mechanism, object
  name completion, and syntax-based highlighting of the interaction
  buffer using Font Lock mode, as well as a very convenient interface to
  the R help system.

  Of course, it also integrates nicely with the mechanisms for editing R
  source using Emacs.  One can write code in one Emacs buffer and send
  whole or parts of it for execution to R; this is helpful for both data
  analysis and programming.  One can also seamlessly integrate with a
  revision control system, in order to maintain a log of changes in your
  programs and data, as well as to allow for the retrieval of past
  versions of the code.

  In addition, it allows you to keep a record of your session, which can
  also be used for error recovery through the use of the transcript
  mode.

  66..

  66..11..

  R (currently) uses a _s_t_a_t_i_c memory model.  This means that when it
  starts up, it asks the operating system to reserve a fixed amount of
  memory for it.  The size of this chunk cannot be changed subsequently.
  Hence, it can happen that not enough memory was allocated.

  In these cases, you should restart R with more memory available, using
  the command line options -n and -v.  To understand these options, one
  needs to know that R maintains separate areas for fixed and variable
  sized objects.  The first of these is allocated as an array of
  SEXPRECs assembled in a list using ``cons cells'' (ordered pairs each
  containing an element of the list and a pointer to the next cell), and
  the second as an array of VECRECs.  The -n option can be used to
  specify the number of cons cells (each occupying 16 bytes) which R is
  to use (the default is 200000), and the -v option to specify the size
  of the vector heap in megabytes (the default is 2).  Only integers are
  allowed for both options.

  E.g., to read in a table of 5000 observations on 40 numeric variables,
  R -v 6 should do.

  Note that the information where to find vectors and strings on the
  heap is stored using cons cells.  Thus, it may also be necessary to
  allocate more space for cons cells in order to perform computations
  with very ``large'' variable-size objects.

  You can find out the current memory comsumption by typing gc() at the
  R prompt.

  66..22..

  R sometimes has problems parsing a file which does not end in a
  newline.  This can happen for example when Emacs is used for editing
  the file and next-line-add-newlines is set to nil.  To avoid the
  problem, either set require-final-newline to a non-nil value in one of
  your Emacs startup files, or make sure R-mode (see question ``Is there
  Emacs Support for R?'') is used for editing R source files (which
  locally ensures this setting).

  Earlier R versions had a similar problem when reading in data files,
  but this should have been taken care of now.

  66..33..

  You can use

       x[i] <- list(NULL)

  to set component i of the list x to NULL, similarly for named compo-
  nents.  Do not set x[i] or x[[i]] to NULL, because this will remove
  the corresponding component from the list.

  For dropping the row names of a matrix x, it may be easier to use
  rownames(x) <- NULL, similarly for column names.

  66..44..  HHooww CCaann II SSaavvee MMyy WWoorrkkssppaaccee??

  The expression

       save(list = ls(), file = ".RData")

  saves the objects in the currently active environment (typically the
  user's .GlobalEnv) to the file `.RData' in the R startup directory.

  66..55..

  To remove all objects in the currently active environment (typically
  the user's .GlobalEnv), you can do

       rm(list = ls())

  77..

  Of course, many many thanks to Robert and Ross for the R system, and
  to the package writers and porters for adding to it.

  Special thanks go to Peter Dalgaard, Paul Gilbert, Martin Maechler,
  and Anthony Rossini for their comments which helped me improve this
  FAQ.

  More to some soon ...


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list