diff -ruN R-3.0.1/NEWS R-patched/NEWS
--- NEWS	2013-05-16 03:05:47.000000000 -0400
+++ NEWS	2013-05-26 18:10:19.000000000 -0400
@@ -1,5 +1,44 @@
 R News
 
+CHANGES IN R 3.0.1 patched:
+
+  NEW FEATURES:
+
+    o The macros used for the texinfo manuals have been changed to work
+      better with the incompatible changes made in texinfo 5.x.
+
+    o The example() and tools::Rd2ex() functions now have parameters to
+      allow them to ignore \dontrun markup in examples.  (Suggested by
+      Peter Solymos.)
+
+  C-LEVEL FACILITIES:
+
+    o Rdefines.h has been tweaked so it can be included in C++ code
+      with R_exts/Boolean.h (which is included by R.h).  Note though
+      that Rdefines.h is not kept up-to-date, and Rinternals.h is
+      preferred for new code.
+
+  BUG FIXES:
+
+    o help.request() could not determine the current version of R on
+      CRAN.  (PR#15241)
+
+    o On Windows, file.info() failed on root directories unless the
+      path was terminated with an explicit ".".  (PR#15302)
+
+    o The regmatches<-() replacement function mishandled results coming
+      from regexpr().  (PR#15311)
+
+    o Documentation for setClass and representation still suggested the
+      deprecated argument representation=. (PR#15312)
+
+    o R CMD config failed in an installed build of R 3.0.1 (only) when
+      a sub-architecture was used.  (Reported by Berwin Turlach.)
+
+    o On Windows, the installer modified the etc/Rconsole and
+      etc/Rprofile.site files even when default options were chosen.
+      (Reported by Tal Galili.)
+
 CHANGES IN R 3.0.1:
 
   NEW FEATURES:
Files R-3.0.1/NEWS.pdf and R-patched/NEWS.pdf differ
diff -ruN R-3.0.1/SVN-REVISION R-patched/SVN-REVISION
--- SVN-REVISION	2013-05-16 03:01:22.000000000 -0400
+++ SVN-REVISION	2013-05-26 18:06:20.000000000 -0400
@@ -1,2 +1,2 @@
-Revision: 62743
-Last Changed Date: 2013-05-16
+Revision: 62815
+Last Changed Date: 2013-05-26
diff -ruN R-3.0.1/VERSION R-patched/VERSION
--- VERSION	2013-05-16 03:00:06.000000000 -0400
+++ VERSION	2013-05-16 03:11:45.000000000 -0400
@@ -1 +1 @@
-3.0.1
+3.0.1 Patched
diff -ruN R-3.0.1/doc/CRAN_mirrors.csv R-patched/doc/CRAN_mirrors.csv
--- doc/CRAN_mirrors.csv	2013-04-18 18:05:05.000000000 -0400
+++ doc/CRAN_mirrors.csv	2013-05-24 18:05:06.000000000 -0400
@@ -32,7 +32,6 @@
 "France (Paris 2)",France,Paris,http://cran.univ-paris1.fr/,"Universite Paris 1 Pantheon-Sorbonne","pierre.latouche # univ-paris1.fr",1,fr
 "Germany (Berlin)",Germany,Berlin,http://mirrors.softliste.de/cran/,"Softliste.de, Berlin","docko # docko.sk",1,de
 "Germany (Bonn)",Germany,Bonn,http://cran.r-mirror.de/,"Stefan Drees, Bonn","stefan # drees.name",1,de
-"Germany (Falkenstein)",Germany,Falkenstein,http://mirror.layerjet.com/cran,layerjet.com,"Elton Chung <elton # layerjet.com>",1,de
 "Germany (Goettingen)",Germany,Goettingen,http://ftp5.gwdg.de/pub/misc/cran/,"GWDG Goettingen","Eberhard Moenkeberg <emoenke # gwdg.de>",1,de
 Greece,Greece,Crete,http://cran.cc.uoc.gr/,"University of Crete","mirrors # Cc.uoc.gr",1,gr
 Hungary,Hungary,Budapest,http://cran.rapporter.net/,"Rapporter.net, Budapest","Daróczi Gergely <gergely # snowl.net>",1,hu
@@ -48,7 +47,6 @@
 "Japan (Tokyo)",Japan,Tokyo,http://cran.ism.ac.jp/,"Institute of Statistical Mathematics, Tokyo","Junji Nakano <nakanoj # ism.ac.jp>",1,jp
 "Korea (Seoul 1)",Korea,Seoul,http://cran.nexr.com/,"NexR Corporation, Seoul","mining # nexr.com",1,kr
 "Korea (Seoul 2)",Korea,Seoul,http://biostat.cau.ac.kr/CRAN/,"Chung-Ang University, Seoul","Sunghow # gmail.com",1,kr
-Latvia,Latvia,Riga,http://mirrors.webhostinggeeks.com/cran/,Webhostinggeeks,"whg.igp # gmail.com",1,lv
 "Mexico (Mexico City)",Mexico,"Mexico City",http://cran.itam.mx/,"Instituto Tecnologico Autonomo de Mexico","Ernesto Barrios <ebarrios # Itam.mx>",1,mx
 "Mexico (Texcoco)",Mexico,Texcoco,http://www.est.colpos.mx/R-mirror/,"Colegio de Postgraduados, Texcoco","perpdgo # gmail.com",1,mx
 "Netherlands (Amsterdam)",Netherlands,Amsterdam,http://cran.xl-mirror.nl/,"XL-Data, Amsterdam","werner # xl-mirror.nl",1,nl
@@ -57,6 +55,7 @@
 Norway,Norway,Bergen,http://cran.uib.no/,"University of Bergen","sundrift # It.uib.no",1,no
 Philippines,Philippines,"Quezon City",http://cran.stat.upd.edu.ph/,"University of the Philippines and PREGINET","edward.p.santos # Up.edu.ph",1,ph
 Poland,Poland,Wroclaw,http://r.meteo.uni.wroc.pl/,"University of Wroclaw","Paweł Netzel <netzel # meteo.uni.wroc.pl>",1,pl
+Portugal,Portugal,Porto,http://cran.dcc.fc.up.pt/,"University of Porto","labcc # labcc.dcc.fc.up.pt",1,pt
 Russia,Russia,Moscow,http://cran.gis-lab.info/,GIS-Lab.info,"sim # gis-lab.info",1,ru
 Singapore,Singapore,Singapore,http://cran.stat.nus.edu.sg/,"National University of Singapore","Zhang Rong <ccezr # nus.edu.sg>",1,sg
 Slovakia,Slovakia,Bratislava,http://cran.fyxm.net/,"FYXM.net, Bratislava","docko # docko.sk",1,sk
@@ -74,7 +73,7 @@
 "UK (St Andrews)",UK,"St Andrews",http://star-www.st-andrews.ac.uk/cran/,"St Andrews University","Lee Kelvin <lsk9 # St-andrews.ac.uk>",1,uk
 "USA (CA 1)",USA,Berkeley,http://cran.cnr.Berkeley.edu,"University of California, Berkeley, CA","casterln # nature.berkeley.edu",1,us
 "USA (CA 2)",USA,"Los Angeles",http://cran.stat.ucla.edu/,"University of California, Los Angeles, CA","Jose Hales-Garcia <jose # stat.ucla.edu>",1,us
-"USA (IA)",USA,Ames,http://streaming.stat.iastate.edu/CRAN/,"Iowa State University, Ames, IA","Ted Peterson <statit # iastate.edu>",1,us
+"USA (IA)",USA,Ames,http://streaming.stat.iastate.edu/CRAN/,"Iowa State University, Ames, IA","statit # iastate.edu",1,us
 "USA (IN)",USA,Bloomington,http://ftp.ussg.iu.edu/CRAN/,"Indiana University","rtadmin # indiana.edu",1,us
 "USA (KS)",USA,Lawrence,http://rweb.quant.ku.edu/cran/,"University of Kansas, Lawrence, KS","Paul Johnson <pauljohn # ku.edu>",1,us
 "USA (MD)",USA,Bethesda,http://watson.nci.nih.gov/cran_mirror/,"National Cancer Institute, Bethesda, MD","Sean Davis <sdavis2 # mail.nih.gov>",1,us
diff -ruN R-3.0.1/doc/NEWS.Rd R-patched/doc/NEWS.Rd
--- doc/NEWS.Rd	2013-05-11 18:05:03.000000000 -0400
+++ doc/NEWS.Rd	2013-05-25 18:05:04.000000000 -0400
@@ -7,6 +7,53 @@
 \title{ R News}
 \encoding{UTF-8}
 
+\section{\Rlogo CHANGES IN R 3.0.1 patched}{
+  \subsection{NEW FEATURES}{
+    \itemize{
+      \item The macros used for the texinfo manuals have been changed to
+      work better with the incompatible changes made in texinfo 5.x.
+      
+      \item The \code{example()} and \code{tools::Rd2ex()} functions now
+      have parameters to allow them to ignore \verb{\dontrun} markup in
+      examples.  (Suggested by Peter Solymos.)
+    }
+  }
+  
+  \subsection{C-LEVEL FACILITIES}{
+    \itemize{
+      \item \file{Rdefines.h} has been tweaked so it can be included in
+      C++ code with \file{R_exts/Boolean.h} (which is included by
+      \file{R.h}).  Note though that \file{Rdefines.h} is not kept
+      up-to-date, and \file{Rinternals.h} is preferred for new code.
+    }
+  }
+  
+  \subsection{BUG FIXES}{
+    \itemize{
+      \item \code{help.request()} could not determine the current version
+      of \R on CRAN.  (\PR{15241})
+      
+      \item On Windows, \code{file.info()} failed on root directories unless
+      the path was terminated with an explicit \code{"."}.  (\PR{15302})
+      
+      \item The \code{regmatches<-()} replacement function mishandled
+      results coming from \code{regexpr()}.  (\PR{15311})
+
+      \item Documentation for \code{setClass} and
+      \code{representation} still suggested the deprecated argument
+      \code{representation=}. (\PR{15312})
+      
+      \item \command{R CMD config} failed in an installed build of \R
+      3.0.1 (only) when a sub-architecture was used.  (Reported by
+      Berwin Turlach.)
+      
+      \item On Windows, the installer modified the \file{etc/Rconsole} and
+      \file{etc/Rprofile.site} files even when default options were 
+      chosen.  (Reported by Tal Galili.)
+    }
+  }
+}
+
 \section{\Rlogo CHANGES IN R 3.0.1}{
   \subsection{NEW FEATURES}{
     \itemize{
@@ -142,28 +189,28 @@
       \item \code{as.dendrogram()}'s \code{hclust} method uses less
       memory and hence gets considerably faster for large (n ~ 1000)
       clusterings, thanks to Daniel Müllner. (\PR{15174})
-      
+
       \item The return value when all workers failed from
       \code{parallel::mclapply(mc.presechedule = TRUE)} was a list of
       strings and not of error objects.  (Spotted by Karl Forner and
-      Bernd Bischl.) 
-      
+      Bernd Bischl.)
+
       \item In \R 3.0.0, when \code{help()} found multiple pages with
       the same alias, the HTML display of all the selections was not
-      produced.  (\PR{15282})  
-      
+      produced.  (\PR{15282})
+
       \item \code{splinefun(method="monoH.FC")} now produces a
       function with first argument named \code{x} and allows
-      \code{deriv=3}, as documented. (\PR{15273})     
-      
-      \item \code{summaryRprof()} would only read the first 
+      \code{deriv=3}, as documented. (\PR{15273})
+
+      \item \code{summaryRprof()} would only read the first
       \code{chunksize} lines of an \code{Rprof} file produced with
       \code{line.profiling=TRUE}. By default, this is the first 100
       seconds.  (\PR{15288})
-      
+
       \item \code{lsfit()} produced an incorrect error message when
       argument \code{x} had more columns than rows or \code{x} had a
-      different number of rows than \code{y}. (Spotted by Renaud Gaujoux.)      
+      different number of rows than \code{y}. (Spotted by Renaud Gaujoux.)
 
       \item Binary operations on equal length vectors copied the
       class name from the second operand when the first had no
diff -ruN R-3.0.1/doc/html/NEWS.html R-patched/doc/html/NEWS.html
--- doc/html/NEWS.html	2013-05-16 03:05:47.000000000 -0400
+++ doc/html/NEWS.html	2013-05-26 18:10:20.000000000 -0400
@@ -8,6 +8,76 @@
 
 <h2> R News</h2>
 
+<h3><img src="../help/figures/../../html/logo.jpg" alt="../../html/logo.jpg" /> CHANGES IN R 3.0.1 patched</h3>
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+<ul>
+<li><p> The macros used for the texinfo manuals have been changed to
+work better with the incompatible changes made in texinfo 5.x.
+</p>
+</li>
+<li><p> The <code>example()</code> and <code>tools::Rd2ex()</code> functions now
+have parameters to allow them to ignore </p>
+<PRE>\dontrun</PRE> markup in
+examples.  (Suggested by Peter Solymos.)
+</li></ul>
+
+
+
+
+<h4>C-LEVEL FACILITIES</h4>
+
+
+<ul>
+<li> <p>&lsquo;<span class="file">Rdefines.h</span>&rsquo; has been tweaked so it can be included in
+C++ code with &lsquo;<span class="file">R_exts/Boolean.h</span>&rsquo; (which is included by
+&lsquo;<span class="file">R.h</span>&rsquo;).  Note though that &lsquo;<span class="file">Rdefines.h</span>&rsquo; is not kept
+up-to-date, and &lsquo;<span class="file">Rinternals.h</span>&rsquo; is preferred for new code.
+</p>
+</li></ul>
+
+
+
+
+<h4>BUG FIXES</h4>
+
+
+<ul>
+<li> <p><code>help.request()</code> could not determine the current version
+of <font face="Courier New,Courier" color="#666666"><b>R</b></font> on CRAN.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15241">PR#15241</a>)
+</p>
+</li>
+<li><p> On Windows, <code>file.info()</code> failed on root directories unless
+the path was terminated with an explicit <code>"."</code>.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15302">PR#15302</a>)
+</p>
+</li>
+<li><p> The <code>regmatches&lt;-()</code> replacement function mishandled
+results coming from <code>regexpr()</code>.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15311">PR#15311</a>)
+</p>
+</li>
+<li><p> Documentation for <code>setClass</code> and
+<code>representation</code> still suggested the deprecated argument
+<code>representation=</code>. (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15312">PR#15312</a>)
+</p>
+</li>
+<li> <p><CODE>R CMD config</CODE> failed in an installed build of <font face="Courier New,Courier" color="#666666"><b>R</b></font>
+3.0.1 (only) when a sub-architecture was used.  (Reported by
+Berwin Turlach.)
+</p>
+</li>
+<li><p> On Windows, the installer modified the &lsquo;<span class="file">etc/Rconsole</span>&rsquo; and
+&lsquo;<span class="file">etc/Rprofile.site</span>&rsquo; files even when default options were 
+chosen.  (Reported by Tal Galili.)
+</p>
+</li></ul>
+
+
+
+
 <h3><img src="../help/figures/../../html/logo.jpg" alt="../../html/logo.jpg" /> CHANGES IN R 3.0.1</h3>
 
 
@@ -191,20 +261,20 @@
 <li><p> The return value when all workers failed from
 <code>parallel::mclapply(mc.presechedule = TRUE)</code> was a list of
 strings and not of error objects.  (Spotted by Karl Forner and
-Bernd Bischl.) 
+Bernd Bischl.)
 </p>
 </li>
 <li><p> In <font face="Courier New,Courier" color="#666666"><b>R</b></font> 3.0.0, when <code>help()</code> found multiple pages with
 the same alias, the HTML display of all the selections was not
-produced.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15282">PR#15282</a>)  
+produced.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15282">PR#15282</a>)
 </p>
 </li>
 <li> <p><code>splinefun(method="monoH.FC")</code> now produces a
 function with first argument named <code>x</code> and allows
-<code>deriv=3</code>, as documented. (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15273">PR#15273</a>)     
+<code>deriv=3</code>, as documented. (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15273">PR#15273</a>)
 </p>
 </li>
-<li> <p><code>summaryRprof()</code> would only read the first 
+<li> <p><code>summaryRprof()</code> would only read the first
 <code>chunksize</code> lines of an <code>Rprof</code> file produced with
 <code>line.profiling=TRUE</code>. By default, this is the first 100
 seconds.  (<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=15288">PR#15288</a>)
@@ -212,7 +282,7 @@
 </li>
 <li> <p><code>lsfit()</code> produced an incorrect error message when
 argument <code>x</code> had more columns than rows or <code>x</code> had a
-different number of rows than <code>y</code>. (Spotted by Renaud Gaujoux.)      
+different number of rows than <code>y</code>. (Spotted by Renaud Gaujoux.)
 </p>
 </li>
 <li><p> Binary operations on equal length vectors copied the
diff -ruN R-3.0.1/doc/html/R-admin.html R-patched/doc/html/R-admin.html
--- doc/html/R-admin.html	2013-05-16 03:11:03.000000000 -0400
+++ doc/html/R-admin.html	2013-05-26 18:15:13.000000000 -0400
@@ -245,7 +245,7 @@
 
 <p>This is a guide to installation and administration for R.
 
-   <p>The current version of this document is 3.0.1 (2013-05-16).
+   <p>The current version of this document is 3.0.1 Patched (2013-05-26).
 
    <p>
 
@@ -986,7 +986,7 @@
 perhaps for some network-mounted systems).
 
    <p>Installation is <em>via</em> the installer
-<samp><span class="file">R-3.0.1-win.exe</span></samp>.  Just double-click on the icon and
+<samp><span class="file">R-3.0.1patched-win.exe</span></samp>.  Just double-click on the icon and
 follow the instructions.  When installing on a 64-bit version of Windows
 the options will include 32- or 64-bit versions of R (and the default is
 to install both).  You can uninstall R from the Control Panel.
@@ -1286,7 +1286,7 @@
 installation (in double quotes if it contains spaces or backslashes).
 
    <p>Both methods create an executable with a standard name such as
-<samp><span class="file">R-3.0.1-win.exe</span></samp>, so please rename it to indicate that
+<samp><span class="file">R-3.0.1patched-win.exe</span></samp>, so please rename it to indicate that
 it is customized.  If you intend to <em>distribute</em> a customized
 installer please do check that license requirements are met &ndash; note that
 the installer will state that the contents are distributed under GPL-2
@@ -1338,21 +1338,21 @@
      make msi
 </pre>
    <p class="noindent">which will result in a file with a name like
-<samp><span class="file">R-3.0.1-win32.msi</span></samp>.  This can be double-clicked to be
+<samp><span class="file">R-3.0.1patched-win32.msi</span></samp>.  This can be double-clicked to be
 installed, but those who need it will know what to do with it (usually
 by running <samp><span class="command">msiexec /i</span></samp> with additional options).  Properties
 that users might want to set from the <samp><span class="command">msiexec</span></samp> command line
 include &lsquo;<samp><span class="samp">ALLUSERS</span></samp>&rsquo;, &lsquo;<samp><span class="samp">INSTALLDIR</span></samp>&rsquo; (something like
-<samp><span class="file">c:\Program Files\R\R-3.0.1</span></samp>) and &lsquo;<samp><span class="samp">RMENU</span></samp>&rsquo; (the path
+<samp><span class="file">c:\Program Files\R\R-3.0.1patched</span></samp>) and &lsquo;<samp><span class="samp">RMENU</span></samp>&rsquo; (the path
 to the &lsquo;<samp><span class="samp">R</span></samp>&rsquo; folder on the start menu) and &lsquo;<samp><span class="samp">STARTDIR</span></samp>&rsquo; (the
 starting directory for R shortcuts, defaulting to something like
 <samp><span class="file">c:\Users\name\Documents\R</span></samp>).
 
    <p>The MSI installer can be built both from a 32-bit build of R
-(<samp><span class="file">R-3.0.1-win32.msi</span></samp>) and from a 64-bit build of R
-(<samp><span class="file">R-3.0.1-win64.msi</span></samp>, optionally including 32-bit files
+(<samp><span class="file">R-3.0.1patched-win32.msi</span></samp>) and from a 64-bit build of R
+(<samp><span class="file">R-3.0.1patched-win64.msi</span></samp>, optionally including 32-bit files
 by setting the macro <code>HOME32</code>, when the name is
-<samp><span class="file">R-3.0.1-win.msi</span></samp>).  Unlike the main installer, a 64-bit
+<samp><span class="file">R-3.0.1patched-win.msi</span></samp>).  Unlike the main installer, a 64-bit
 MSI installer can only be run on 64-bit Windows.
 
    <p>Thanks to David del Campo (Dept of Statistics, University of Oxford)
@@ -1421,10 +1421,6 @@
 should run on all Macs from mid-2008 on.  For older Intel Macs and some
 older versions of the OS you can install R from the sources.
 
-   <p>Note that unlike <acronym>CRAN</acronym> binary distributions of R 2.x.y,
-there is only a 64-bit version (and hence no separate <code>R64.app</code>
-application, nor <samp><span class="command">R64</span></samp>/<samp><span class="command">R32</span></samp> front-ends).
-
    <p>To install, just double-click on the icon of the file you downloaded. 
 At the `Installation Type' stage, note the option to `Customize'.  This
 currently shows three components (`Package Name').  Everyone will need
@@ -1789,8 +1785,7 @@
 <acronym>CRAN</acronym> or local files.
 
    <p>Note that many binary packages including compiled code are tied to a
-particular series (e.g. R 2.15.x or 3.0.x) of R: in any case R 3.0.x
-cannot use any binary packages built for R 2.15.x or earlier.
+particular series (e.g. R 3.0.x or 3.1.x) of R.
 
    <p>Installing source packages which do not contain compiled code should
 work with no additional tools. For others you will need the `Command
@@ -2611,7 +2606,7 @@
 <samp><span class="file">texinfo.tex</span></samp> need to be compatible: we have seen problems with
 older TeX distributions (TeXLive 2007 and MiKTeX 2.8) used with
 <strong>texinfo</strong> 4.13.  It should be possible to use <samp><span class="command">makeinfo</span></samp>
-version 5.0, but e.g.. 4.13 produces better-formatted output.
+version 5.x.
 
    <p><a name="index-Vignettes-69"></a>The PDF documentation (including <samp><span class="file">doc/NEWS.pdf</span></samp>) and building
 vignettes needs <samp><span class="command">pdftex</span></samp> and <samp><span class="command">pdflatex</span></samp>.  We require
@@ -4693,7 +4688,7 @@
 
 <h3 class="section">D.2 The Inno Setup installer</h3>
 
-<p>To make the installer package (<samp><span class="file">R-3.0.1-win.exe</span></samp>) we
+<p>To make the installer package (<samp><span class="file">R-3.0.1patched-win.exe</span></samp>) we
 currently require the Unicode version of Inno Setup 5.3.7 or later from
 <a href="http://jrsoftware.org/">http://jrsoftware.org/</a>. This is <em>not</em> included in
 <samp><span class="file">Rtools*.exe</span></samp>.
diff -ruN R-3.0.1/doc/manual/R-admin.texi R-patched/doc/manual/R-admin.texi
--- doc/manual/R-admin.texi	2013-04-29 07:05:23.000000000 -0400
+++ doc/manual/R-admin.texi	2013-05-24 18:05:06.000000000 -0400
@@ -1473,10 +1473,6 @@
 should run on all Macs from mid-2008 on.  For older Intel Macs and some
 older versions of the OS you can install @R{} from the sources.
 
-Note that unlike @acronym{CRAN} binary distributions of @R{} 2.x.y,
-there is only a 64-bit version (and hence no separate @code{R64.app}
-application, nor @command{R64}/@command{R32} front-ends).
-
 To install, just double-click on the icon of the file you downloaded.
 At the `Installation Type' stage, note the option to `Customize'.  This
 currently shows three components (`Package Name').  Everyone will need
@@ -1904,8 +1900,7 @@
 @acronym{CRAN} or local files.
 
 Note that many binary packages including compiled code are tied to a
-particular series (e.g.@: @R{} 2.15.x or 3.0.x) of @R{}: in any case @R{} 3.0.x
-cannot use any binary packages built for @R{} 2.15.x or earlier.
+particular series (e.g.@: @R{} 3.0.x or 3.1.x) of @R{}.
 
 Installing source packages which do not contain compiled code should
 work with no additional tools. For others you will need the `Command
@@ -2863,7 +2858,7 @@
 @file{texinfo.tex} need to be compatible: we have seen problems with
 older @TeX{} distributions (TeXLive 2007 and MiKTeX 2.8) used with
 @pkg{texinfo} 4.13.  It should be possible to use @command{makeinfo}
-version 5.0, but e.g..@: 4.13 produces better-formatted output.
+version 5.x.
 
 @cindex Vignettes
 The PDF documentation (including @file{doc/NEWS.pdf}) and building
diff -ruN R-3.0.1/doc/manual/R-defs.texi R-patched/doc/manual/R-defs.texi
--- doc/manual/R-defs.texi	2013-04-03 18:05:07.000000000 -0400
+++ doc/manual/R-defs.texi	2013-05-24 18:05:06.000000000 -0400
@@ -17,16 +17,18 @@
 @acronym{HTML}
 @end macro
 
-@macro eqn {t, a}
 @iftex
+@macro eqn {t, a}
 @tex
 $\t\$%
 @end tex
+@end macro
 @end iftex
 @ifnottex
-\a\@c
-@end ifnottex
+@macro eqn {t, a}
+\a\
 @end macro
+@end ifnottex
 
 @macro pkg {p}
 @strong{\p\}
diff -ruN R-3.0.1/doc/manual/R-exts.R R-patched/doc/manual/R-exts.R
--- doc/manual/R-exts.R	2011-06-17 06:39:34.000000000 -0400
+++ doc/manual/R-exts.R	2013-05-26 18:05:04.000000000 -0400
@@ -33,9 +33,6 @@
 u <- rep(1, 5)
 conv(u, u)
 
-conv <- function(a, b) .Call("convolve2b", a, b)
-conv(u, u)
-
 convE <- function(a, b) .External("convolveE", a, b)
 convE(u, u)
 
@@ -71,7 +68,7 @@
 
 ## ----- numerical derivatives -----
 
-numeric.deriv <- function(expr, theta, rho=sys.frame(sys.parent()))
+numeric.deriv <- function(expr, theta, rho = sys.frame(sys.parent()))
 {
     eps <- sqrt(.Machine$double.eps)
     ans <- eval(substitute(expr), rho)
diff -ruN R-3.0.1/doc/manual/R-exts.c R-patched/doc/manual/R-exts.c
--- doc/manual/R-exts.c	2013-02-04 18:05:11.000000000 -0500
+++ doc/manual/R-exts.c	2013-05-26 18:05:04.000000000 -0400
@@ -13,27 +13,22 @@
 /* second version */
 SEXP out(SEXP x, SEXP y)
 {
-    int i, j, nx = length(x), ny = length(y);
-    double tmp, *rx = REAL(x), *ry = REAL(y), *rans;
-    SEXP ans, dim, dimnames;
-
-    PROTECT(ans = allocMatrix(REALSXP, nx, ny));
-    rans = REAL(ans);
-    for(i = 0; i < nx; i++) {
-	tmp = rx[i];
-	for(j = 0; j < ny; j++)
+    int nx = length(x), ny = length(y);
+    SEXP ans = PROTECT(allocMatrix(REALSXP, nx, ny));
+    double *rx = REAL(x), *ry = REAL(y), *rans = REAL(ans);
+
+    for(int i = 0; i < nx; i++) {
+	double tmp = rx[i];
+	for(int j = 0; j < ny; j++)
 	    rans[i + nx*j] = tmp * ry[j];
     }
-    PROTECT(dim = allocVector(INTSXP, 2));
-    INTEGER(dim)[0] = nx; INTEGER(dim)[1] = ny;
-    setAttrib(ans, R_DimSymbol, dim);
 
-    PROTECT(dimnames = allocVector(VECSXP, 2));
+    SEXP dimnames = PROTECT(allocVector(VECSXP, 2));
     SET_VECTOR_ELT(dimnames, 0, getAttrib(x, R_NamesSymbol));
     SET_VECTOR_ELT(dimnames, 1, getAttrib(y, R_NamesSymbol));
     setAttrib(ans, R_DimNamesSymbol, dimnames);
-    UNPROTECT(3);
-    return(ans);
+    UNPROTECT(2);
+    return ans;
 }
 
 /* get the list element named str, or return NULL */
@@ -60,69 +55,48 @@
 	error("rho should be an environment");
     ans = findVar(install(CHAR(STRING_ELT(name, 0))), rho);
     Rprintf("first value is %f\n", REAL(ans)[0]);
-    return(R_NilValue);
+    return R_NilValue;
 }
 
 /* ----- Convolution via .Call  ----- */
 
-#include <Rdefines.h>
+#include <Rinternals.h>
 SEXP convolve2(SEXP a, SEXP b)
 {
-    int i, j, na, nb, nab;
+    int na, nb, nab;
     double *xa, *xb, *xab;
     SEXP ab;
 
-    PROTECT(a = AS_NUMERIC(a));
-    PROTECT(b = AS_NUMERIC(b));
-    na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1;
-    PROTECT(ab = NEW_NUMERIC(nab));
-    xa = NUMERIC_POINTER(a); xb = NUMERIC_POINTER(b);
-    xab = NUMERIC_POINTER(ab);
-    for(i = 0; i < nab; i++) xab[i] = 0.0;
-    for(i = 0; i < na; i++)
-	for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
-    UNPROTECT(3);
-    return(ab);
-}
-
-SEXP convolve2b(SEXP a, SEXP b)
-{
-    int i, j, na, nb, nab;
-    double *xa, *xb, *xab;
-    SEXP ab;
-
-    PROTECT(a = coerceVector(a, REALSXP));
-    PROTECT(b = coerceVector(b, REALSXP));
+    a = PROTECT(coerceVector(a, REALSXP));
+    b = PROTECT(coerceVector(b, REALSXP));
     na = length(a); nb = length(b); nab = na + nb - 1;
-    PROTECT(ab = allocVector(REALSXP, nab));
-    xa = REAL(a); xb = REAL(b);
-    xab = REAL(ab);
-    for(i = 0; i < nab; i++) xab[i] = 0.0;
-    for(i = 0; i < na; i++)
-	for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
+    ab = PROTECT(allocVector(REALSXP, nab));
+    xa = REAL(a); xb = REAL(b); xab = REAL(ab);
+    for(int i = 0; i < nab; i++) xab[i] = 0.0;
+    for(int i = 0; i < na; i++)
+        for(int j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
     UNPROTECT(3);
-    return(ab);
+    return ab;
 }
 
 /* ----- Convolution via .External  ----- */
 
 SEXP convolveE(SEXP args)
 {
-    int i, j, na, nb, nab;
+    int na, nb, nab;
     double *xa, *xb, *xab;
     SEXP a, b, ab;
 
-    PROTECT(a = coerceVector(CADR(args), REALSXP));
-    PROTECT(b = coerceVector(CADDR(args), REALSXP));
+    a = PROTECT(coerceVector(CADR(args), REALSXP));
+    b = PROTECT(coerceVector(CADDR(args), REALSXP));
     na = length(a); nb = length(b); nab = na + nb - 1;
-    PROTECT(ab = allocVector(REALSXP, nab));
-    xa = REAL(a); xb = REAL(b);
-    xab = REAL(ab);
-    for(i = 0; i < nab; i++) xab[i] = 0.0;
-    for(i = 0; i < na; i++)
-	for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
+    ab = PROTECT(allocVector(REALSXP, nab));
+    xa = REAL(a); xb = REAL(b); xab = REAL(ab);
+    for(int i = 0; i < nab; i++) xab[i] = 0.0;
+    for(int i = 0; i < na; i++)
+	for(int j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
     UNPROTECT(3);
-    return(ab);
+    return ab;
 }
 
 /* ----- Show arguments  ----- */
@@ -160,7 +134,7 @@
 	    Rprintf("[%d] '%s' R type\n", i+1, name);
 	}
     }
-    return(R_NilValue);
+    return R_NilValue;
 }
 
 SEXP showArgs1(SEXP largs)
@@ -193,45 +167,45 @@
 	    Rprintf("[%d] '%s' R type\n", i+1, name);
 	}
     }
-    return(R_NilValue);
+    return R_NilValue;
 }
 
 /* ----- Skeleton lapply ----- */
 
 SEXP lapply(SEXP list, SEXP expr, SEXP rho)
 {
-    int i, n = length(list);
+    int n = length(list);
     SEXP ans;
 
     if(!isNewList(list)) error("'list' must be a list");
     if(!isEnvironment(rho)) error("'rho' should be an environment");
-    PROTECT(ans = allocVector(VECSXP, n));
-    for(i = 0; i < n; i++) {
+    ans = PROTECT(allocVector(VECSXP, n));
+    for(int i = 0; i < n; i++) {
 	defineVar(install("x"), VECTOR_ELT(list, i), rho);
 	SET_VECTOR_ELT(ans, i, eval(expr, rho));
     }
     setAttrib(ans, R_NamesSymbol, getAttrib(list, R_NamesSymbol));
     UNPROTECT(1);
-    return(ans);
+    return ans;
 }
 
 SEXP lapply2(SEXP list, SEXP fn, SEXP rho)
 {
-    int i, n = length(list);
+    int n = length(list);
     SEXP R_fcall, ans;
 
     if(!isNewList(list)) error("'list' must be a list");
     if(!isFunction(fn)) error("'fn' must be a function");
     if(!isEnvironment(rho)) error("'rho' should be an environment");
-    PROTECT(R_fcall = lang2(fn, R_NilValue));
-    PROTECT(ans = allocVector(VECSXP, n));
-    for(i = 0; i < n; i++) {
+    R_fcall = PROTECT(lang2(fn, R_NilValue));
+    ans = PROTECT(allocVector(VECSXP, n));
+    for(int i = 0; i < n; i++) {
 	SETCADR(R_fcall, VECTOR_ELT(list, i));
 	SET_VECTOR_ELT(ans, i, eval(R_fcall, rho));
     }
     setAttrib(ans, R_NamesSymbol, getAttrib(list, R_NamesSymbol));
     UNPROTECT(2);
-    return(ans);
+    return ans;
 }
 
 /* ----- Zero-finding ----- */
@@ -239,7 +213,7 @@
 SEXP mkans(double x)
 {
     SEXP ans;
-    PROTECT(ans = allocVector(REALSXP, 1));
+    ans = PROTECT(allocVector(REALSXP, 1));
     REAL(ans)[0] = x;
     UNPROTECT(1);
     return ans;
@@ -248,7 +222,7 @@
 double feval(double x, SEXP f, SEXP rho)
 {
     defineVar(install("x"), mkans(x), rho);
-    return(REAL(eval(f, rho))[0]);
+    return REAL(eval(f, rho))[0];
 }
 
 SEXP zero(SEXP f, SEXP guesses, SEXP stol, SEXP rho)
@@ -285,7 +259,7 @@
 {
     SEXP theta, expr, rho, ans, ans1, gradient, par, dimnames;
     double tt, xx, delta, eps = sqrt(DOUBLE_EPS), *rgr, *rans;
-    int start, i, j;
+    int i, start;
 
     expr = CADR(args);
     if(!isString(theta = CADDR(args)))
@@ -293,8 +267,8 @@
     if(!isEnvironment(rho = CADDDR(args)))
 	error("rho should be an environment");
 
-    PROTECT(ans = coerceVector(eval(expr, rho), REALSXP));
-    PROTECT(gradient = allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
+    ans = PROTECT(coerceVector(eval(expr, rho), REALSXP));
+    gradient = PROTECT(allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
     rgr = REAL(gradient); rans = REAL(ans);
 
     for(i = 0, start = 0; i < LENGTH(theta); i++, start += LENGTH(ans)) {
@@ -303,14 +277,14 @@
 	xx = fabs(tt);
 	delta = (xx < 1) ? eps : xx*eps;
 	REAL(par)[0] += delta;
-	PROTECT(ans1 = coerceVector(eval(expr, rho), REALSXP));
-	for(j = 0; j < LENGTH(ans); j++)
+	ans1 = PROTECT(coerceVector(eval(expr, rho), REALSXP));
+	for(int j = 0; j < LENGTH(ans); j++)
             rgr[j + start] = (REAL(ans1)[j] - rans[j])/delta;
 	REAL(par)[0] = tt;
 	UNPROTECT(2); /* par, ans1 */
     }
 
-    PROTECT(dimnames = allocVector(VECSXP, 2));
+    dimnames = PROTECT(allocVector(VECSXP, 2));
     SET_VECTOR_ELT(dimnames, 1,  theta);
     dimnamesgets(gradient, dimnames);
     setAttrib(ans, install("gradient"), gradient);
diff -ruN R-3.0.1/doc/manual/R-exts.texi R-patched/doc/manual/R-exts.texi
--- doc/manual/R-exts.texi	2013-04-22 18:05:03.000000000 -0400
+++ doc/manual/R-exts.texi	2013-05-26 18:05:04.000000000 -0400
@@ -219,13 +219,19 @@
 @pxref{Lazy loading, , Lazy loading, R-ints,  R Internals}.)
 @end ifset
 
+@cindex CRAN
+@acronym{CRAN} is a network of WWW sites holding the @R{} distributions
+and contributed code, especially @R{} packages.  Users of @R{} are
+encouraged to join in the collaborative project and to submit their own
+packages to @acronym{CRAN}: current instructions are linked from
+@uref{http://CRAN.R-project.org/banner.shtml#submitting}.
+
 
 @menu
 * Package structure::           
 * Configure and cleanup::       
 * Checking and building packages::  
 * Writing package vignettes::   
-* Submitting a package to CRAN::  
 * Package namespaces::          
 * Writing portable packages::   
 * Diagnostic messages::         
@@ -1236,7 +1242,7 @@
 @end example
 
 @noindent
-then downoad the sources from
+then download the sources from
 @uref{http://sourceforge.net/projects/tcllib/files/BWidget/} and
 at the command line run
 
@@ -2596,7 +2602,7 @@
 who do not have access to Windows but wish to provide binaries for the
 Windows platform.
 
-@node Writing package vignettes, Submitting a package to CRAN, Checking and building packages, Creating R packages
+@node Writing package vignettes, Package namespaces, Checking and building packages, Creating R packages
 @section Writing package vignettes
 @cindex vignettes
 @cindex Sweave
@@ -2854,21 +2860,8 @@
 See the @code{?tools::vignetteEngine} help topic for details
 on engine registration.
 
-@node Submitting a package to CRAN, Package namespaces, Writing package vignettes, Creating R packages
-@section Submitting a package to @acronym{CRAN}
-@cindex CRAN
-@cindex CRAN submission
-@cindex Submitting to CRAN
-
-@acronym{CRAN} is a network of WWW sites holding the @R{} distributions
-and contributed code, especially @R{} packages.  Users of @R{} are
-encouraged to join in the collaborative project and to submit their own
-packages to @acronym{CRAN}.
 
-Current submission instructions are linked from
-@uref{http://CRAN.R-project.org/banner.shtml#submitting}.
-
-@node Package namespaces, Writing portable packages, Submitting a package to CRAN, Creating R packages
+@node Package namespaces, Writing portable packages, Writing package vignettes, Creating R packages
 @section Package namespaces
 @cindex namespaces
 
@@ -7287,12 +7280,12 @@
 @group
 void convolve(double *a, int *na, double *b, int *nb, double *ab)
 @{
-    int i, j, nab = *na + *nb - 1;
+    int nab = *na + *nb - 1;
 
-    for(i = 0; i < nab; i++)
+    for(int i = 0; i < nab; i++)
         ab[i] = 0.0;
-    for(i = 0; i < *na; i++)
-        for(j = 0; j < *nb; j++)
+    for(int i = 0; i < *na; i++)
+        for(int j = 0; j < *nb; j++)
             ab[i + j] += a[i] * b[j];
 @}
 @end group
@@ -8066,28 +8059,24 @@
 package @pkg{packB} is incorporated when package @pkg{packA} is
 installed, we only need to find the static library at install time for
 package @pkg{packB}.  The only issue is to find package @pkg{packB}, and
-for that we can ask @R{} by something like (lines broken for display here)
+for that we can ask @R{} by something like (long lines broken for display here)
 
 @example
-PKGB_PATH=`echo 'cat(system.file("libs", .Platform$$r_arch,
- package="packB", mustWork=TRUE))' \
+PKGB_PATH=`echo 'library(packB);
+  cat(system.file("libs",  package="packB", mustWork=TRUE))' \
  | "$@{R_HOME@}/bin/R" --vanilla --slave`
-PKG_LIBS="$(PKGB_PATH)/libpackB.a"
+PKG_LIBS="$(PKGB_PATH)$(R_ARCH)/libpackB.a"
 @end example
 
-@noindent
-which will give an empty path component if sub-architectures are not in
-use (but that works on current platforms).
-
 For a dynamic library @file{packB/libs/libpackB.so}
 (@file{packB/libs/libpackB.dylib} on OS X: note that you cannot link to
 a shared object, @file{.so} on that platform) we could use
 
 @example
-PKGB_PATH=`echo 'cat(system.file("libs", .Platform$$r_arch, 
-  package="packB", mustWork=TRUE))' \
+PKGB_PATH=`echo 'library(packB); 
+  cat(system.file("libs", package="packB", mustWork=TRUE))' \
  | "$@{R_HOME@}/bin/R" --vanilla --slave`
-PKG_LIBS=-L"$(PKGB_PATH)" -lpackB
+PKG_LIBS=-L"$(PKGB_PATH)$(R_ARCH)" -lpackB
 @end example
 
 @noindent
@@ -8105,9 +8094,10 @@
 this can be done by e.g.@:
 
 @example
-PKGB_PATH=`echo 'library(packB); cat(system.file("libs", package="packB"))' \
+PKGB_PATH=`echo 'library(packB); 
+  cat(system.file("libs", package="packB", mustWork=TRUE)))' \
  | "$@{R_HOME@}/bin/R" --vanilla --slave`
-PKG_LIBS=-L"$(PKGB_PATH)" -rpath "$(PKGB_PATH)" -lpackB
+PKG_LIBS=-L"$(PKGB_PATH)$(R_ARCH)" -rpath "$(PKGB_PATH)$(R_ARCH)" -lpackB
 @end example
 
 @noindent
@@ -8154,9 +8144,10 @@
 where it is by something like
 
 @example
-PKGB_PATH=`echo 'library(packB); cat(system.file("libs", package="packB"))' \
+PKGB_PATH=`echo 'library(packB); 
+  cat(system.file("libs", package="packB", mustWork=TRUE))' \
  | rterm --vanilla --slave`
-PKG_LIBS= -L"$(PKGB_PATH)"$(R_ARCH) -lexB
+PKG_LIBS= -L"$(PKGB_PATH)$(R_ARCH)" -lexB
 @end example
 
 Another possibility is to use an import library, shipping with package
@@ -8182,7 +8173,7 @@
 @file{packB.dll} or @file{packB.dll} depends on it) and @pkg{packB} has
 been loaded before @pkg{packA}, then nothing more needs to be done as
 @file{exB.dll} will already be loaded into the @R{} executable.  (This
-is the most common scenario).
+is the most common scenario.)
 
 More generally, we can use the @code{DLLpath} argument to
 @code{library.dynam} to ensure that @code{exB.dll} is found, for example
@@ -8209,9 +8200,8 @@
 @code{.Call} and @code{.External} functions.  The syntax for the calling
 function in @R{} in each case is similar to that of @code{.C}, but the
 two functions have different C interfaces.  Generally the @code{.Call}
-interface (which is modelled on the interface of the same name in @Sl{}
-version 4) is a little simpler to use, but @code{.External} is a little
-more general.
+interface is simpler to use, but @code{.External} is a little more
+general.
 @findex .Call
 @findex .External
 
@@ -8259,48 +8249,39 @@
 Here @code{args} is a @code{LISTSXP}, a Lisp-style pairlist from which
 the arguments can be extracted.
 
-In each case the @R{} objects are available for manipulation @emph{via} a set
-of functions and macros defined in the header file @file{Rinternals.h}
-or some S4-compatibility macros defined in @file{Rdefines.h}.  See
-@ref{Interface functions .Call and .External} for details on
-@code{.Call} and @code{.External}.
+In each case the @R{} objects are available for manipulation @emph{via}
+a set of functions and macros defined in the header file
+@file{Rinternals.h} or some @Sl{}-compatibility macros@footnote{That is,
+similar to those defined in @Sl{} version 4 from the 1990s: these are
+not kept up to date and are not recommended for new projects.} defined
+in @file{Rdefines.h}.  See @ref{Interface functions .Call and .External}
+for details on @code{.Call} and @code{.External}.
 
 Before you decide to use @code{.Call} or @code{.External}, you should
 look at other alternatives.  First, consider working in interpreted @R{}
 code; if this is fast enough, this is normally the best option.  You
 should also see if using @code{.C} is enough.  If the task to be
 performed in C is simple enough involving only atomic vectors and
-requiring no call to @R{}, @code{.C} suffices.  The new interfaces are
-relatively recent additions to @Sl{} and @R{}, and a great deal of
-useful code has been written using just @code{.C} before they were
-available.  The @code{.Call} and @code{.External} interfaces allow much
-more control, but they also impose much greater responsibilities so need
-to be used with care.  Neither @code{.Call} nor @code{.External} copy
-their arguments: you should treat arguments you receive through these
+requiring no call to @R{}, @code{.C} suffices. A great deal of useful
+code was written using just @code{.C} before @code{.Call} and
+@code{.External} were available.  These interfaces allow much more
+control, but they also impose much greater responsibilities so need to
+be used with care.  Neither @code{.Call} nor @code{.External} copy their
+arguments: you should treat arguments you receive through these
 interfaces as read-only.
 
-There are two approaches that can be taken to handling @R{} objects from
-within C code.  The first (historically) is to use the macros and
-functions that have been used to implement the core parts of @R{}
-through @code{.Internal} calls.  A public@footnote{ @pxref{The R API}:
-note that these are not all part of the API.}  subset of these is
-defined in the header file @file{Rinternals.h} in the directory
-@file{@var{R_INCLUDE_DIR}} (default @file{@var{R_HOME}/include}) that
-should be available on any @R{} installation.
-
-Another approach is to use @R{} versions of the macros and functions
-defined for the @Sl{} version 4 interface @code{.Call}, which are
-defined in the header file @file{Rdefines.h}.  This is a somewhat
-simpler approach, and is to be preferred if the code is intended to be
-shared with @Sl{}.  However, it is less well documented and even less
-tested.  Note too that some idiomatic S4 constructions with these macros
-(such as assigning elements of character vectors or lists) are invalid
-in @R{}.
-
-A substantial amount of @R{} is implemented using the functions and
-macros described here, so the @R{} source code provides a rich source of
-examples and ``how to do it'': do make use of the source code for
-inspirational examples.
+To handle @R{} objects from within C code we use the macros and functions
+that have been used to implement the core parts of @R{}.  A
+public@footnote{ @pxref{The R API}: note that these are not all part of
+the API.}  subset of these is defined in the header file
+@file{Rinternals.h} in the directory @file{@var{R_INCLUDE_DIR}} (default
+@file{@var{R_HOME}/include}) that should be available on any @R{}
+installation.
+
+A substantial amount of @R{}, including the standard packages, is
+implemented using the functions and macros described here, so the @R{}
+source code provides a rich source of examples and ``how to do it'': do
+make use of the source code for inspirational examples.
 
 It is necessary to know something about how @R{} objects are handled in
 C code.  All the @R{} objects you will deal with will be handled with
@@ -8374,8 +8355,7 @@
 warn about @code{"stack imbalance in .Call"} (or @code{.External}) if
 the housekeeping is wrong.
 
-Here is a small example of creating an @R{} numeric vector in C code.
-First we use the macros in @file{Rinternals.h}:
+Here is a small example of creating an @R{} numeric vector in C code:
 
 @example
 @group
@@ -8384,30 +8364,13 @@
 
     SEXP ab;
       ....
-    PROTECT(ab = allocVector(REALSXP, 2));
+    ab = PROTECT(allocVector(REALSXP, 2));
     REAL(ab)[0] = 123.45;
     REAL(ab)[1] = 67.89;
     UNPROTECT(1);
 @end group
 @end example
 
-@noindent
-and then those in @file{Rdefines.h}:
-
-@example
-@group
-#include <R.h>
-#include <Rdefines.h>
-
-    SEXP ab;
-      ....
-    PROTECT(ab = NEW_NUMERIC(2));
-    NUMERIC_POINTER(ab)[0] = 123.45;
-    NUMERIC_POINTER(ab)[1] = 67.89;
-    UNPROTECT(1);
-@end group
-@end example
-
 Now, the reader may ask how the @R{} object could possibly get removed
 during those manipulations, as it is just our C code that is running.
 As it happens, we can do without the protection in this example, but in
@@ -8448,8 +8411,8 @@
     PROTECT_INDEX ipx;
 
     ....
-    PROTECT_WITH_INDEX(s = eval(OS->R_fcall, OS->R_env), &ipx);
-    REPROTECT(s = coerceVector(s, REALSXP), ipx);
+    s = PROTECT_WITH_INDEX(eval(OS->R_fcall, OS->R_env), &ipx);
+    s = REPROTECT(coerceVector(s, REALSXP), ipx);
 @end example
 
 Note that it is dangerous to mix @code{UNPROTECT_PTR} with
@@ -8463,10 +8426,7 @@
 
 For many purposes it is sufficient to allocate @R{} objects and
 manipulate those.  There are quite a few @code{alloc@var{Xxx}} functions
-defined in @file{Rinternals.h}---you may want to explore them.  These
-allocate @R{} objects of various types, and for the standard vector
-types there are equivalent @code{NEW_@var{XXX}} macros defined in
-@file{Rdefines.h}.
+defined in @file{Rinternals.h}---you may want to explore them.
 
 If storage is required for C objects during the calculations this is
 best allocating by calling @code{R_alloc}; @pxref{Memory allocation}.
@@ -8479,12 +8439,10 @@
 @cindex Details of R types
 
 Users of the @file{Rinternals.h} macros will need to know how the @R{}
-types are known internally: if the @file{Rdefines.h} macros are used
-then S4-compatible names are used.
-
-The different @R{} data types are represented in C by @dfn{SEXPTYPE}.
-Some of these are familiar from @R{} and some are internal data types.
-The usual @R{} object modes are given in the table.
+types are known internally.  The different @R{} data types are
+represented in C by @dfn{SEXPTYPE}.  Some of these are familiar from
+@R{} and some are internal data types.  The usual @R{} object modes are
+given in the table.
 
 @quotation
 @multitable {SEXPTYPE} {numeric with storage mode integer integer}
@@ -8519,25 +8477,17 @@
 and @code{isString} to do type checking.  See the header file
 @file{Rinternals.h} for definitions of other such functions.  All of
 these take a @code{SEXP} as argument and return 1 or 0 to indicate
-@var{TRUE} or @var{FALSE}.  Once again there are two ways to do this,
-and @file{Rdefines.h} has macros such as @code{IS_NUMERIC}.
+@var{TRUE} or @var{FALSE}.
 
 What happens if the @code{SEXP} is not of the correct type?  Sometimes
 you have no other option except to generate an error.  You can use the
 function @code{error} for this.  It is usually better to coerce the
 object to the correct type.  For example, if you find that an
 @code{SEXP} is of the type @code{INTEGER}, but you need a @code{REAL}
-object, you can change the type by using, equivalently,
-
-@example
-PROTECT(@var{newSexp} = coerceVector(@var{oldSexp}, REALSXP));
-@end example
-
-@noindent
-or
+object, you can change the type by using
 
 @example
-PROTECT(@var{newSexp} = AS_NUMERIC(@var{oldSexp}));
+@var{newSexp} = PROTECT(coerceVector(@var{oldSexp}, REALSXP));
 @end example
 
 @noindent
@@ -8594,19 +8544,16 @@
 
 SEXP out(SEXP x, SEXP y)
 @{
-    int i, j, nx = length(x), ny = length(y);
-    double tmp, *rx = REAL(x), *ry = REAL(y), *rans;
-    SEXP ans;
-
-    PROTECT(ans = allocMatrix(REALSXP, nx, ny));
-    rans = REAL(ans);
-    for(i = 0; i < nx; i++) @{
-        tmp = rx[i];
-        for(j = 0; j < ny; j++)
+    int nx = length(x), ny = length(y);
+    SEXP ans = PROTECT(allocMatrix(REALSXP, nx, ny));
+    double *rx = REAL(x), *ry = REAL(y), *rans = REAL(ans);
+    for(int i = 0; i < nx; i++) @{
+        double tmp = rx[i];
+        for(int j = 0; j < ny; j++)
             rans[i + nx*j] = tmp * ry[j];
     @}
     UNPROTECT(1);
-    return(ans);
+    return ans;
 @}
 @end group
 @end example
@@ -8626,29 +8573,17 @@
 @group
 SEXP out(SEXP x, SEXP y)
 @{
-    int i, j, nx = length(x), ny = length(y);
-    double tmp, *rx = REAL(x), *ry = REAL(y), *rans;
-    SEXP ans, dim, dimnames;
-@end group
-
-@group
-    PROTECT(ans = allocVector(REALSXP, nx*ny));
-    rans = REAL(ans);
-    for(i = 0; i < nx; i++) @{
-    tmp = rx[i];
-    for(j = 0; j < ny; j++)
-         rans[i + nx*j] = tmp * ry[j];
+    int nx = length(x), ny = length(y);
+    SEXP ans = PROTECT(allocMatrix(REALSXP, nx, ny));
+    double *rx = REAL(x), *ry = REAL(y), *rans = REAL(ans);
+
+    for(int i = 0; i < nx; i++) @{
+      double tmp = rx[i];
+      for(int j = 0; j < ny; j++)
+        rans[i + nx*j] = tmp * ry[j];
     @}
-@end group
 
-@group
-    PROTECT(dim = allocVector(INTSXP, 2));
-    INTEGER(dim)[0] = nx; INTEGER(dim)[1] = ny;
-    setAttrib(ans, R_DimSymbol, dim);
-@end group
-
-@group
-    PROTECT(dimnames = allocVector(VECSXP, 2));
+    SEXP dimnames = PROTECT(allocVector(VECSXP, 2));
     SET_VECTOR_ELT(dimnames, 0, getAttrib(x, R_NamesSymbol));
     SET_VECTOR_ELT(dimnames, 1, getAttrib(y, R_NamesSymbol));
     setAttrib(ans, R_DimNamesSymbol, dimnames);
@@ -8656,7 +8591,7 @@
 
 @group
     UNPROTECT(3);
-    return(ans);
+    return ans;
 @}
 @end group
 @end example
@@ -8685,7 +8620,7 @@
 @example
 @group
     SEXP version;
-    PROTECT(version = allocVector(REALSXP, 1));
+    version = PROTECT(allocVector(REALSXP, 1));
     REAL(version)[0] = 3.0;
     setAttrib(ans, install("version"), version);
     UNPROTECT(1);
@@ -8704,7 +8639,18 @@
 @end example
 
 @noindent
-if it is to be done frequently.
+if it is to be done frequently. 
+
+This example can be simplified by another convenience function:
+
+@example
+@group
+    SEXP version = PROTECT(ScalarReal(3.0));
+    setAttrib(ans, install("version"), version);
+    UNPROTECT(1);
+@end group
+@end example
+
 
 @node Classes, Handling lists, Attributes, Handling R objects in C
 @subsection Classes
@@ -8718,15 +8664,15 @@
 @example
 @group
 #include <R.h>
-#include <Rdefines.h>
+#include <Rinternals.h>
       ....
     SEXP ans, dim, dimnames, class;
       ....
-    PROTECT(class = allocVector(STRSXP, 1));
+    class = PROTECT(allocVector(STRSXP, 1));
     SET_STRING_ELT(class, 0, mkChar("mat"));
     classgets(ans, class);
     UNPROTECT(4);
-    return(ans);
+    return ans;
 @}
 @end group
 @end example
@@ -8852,7 +8798,7 @@
         error("rho should be an environment");
     ans = findVar(install(CHAR(STRING_ELT(name, 0))), rho);
     Rprintf("first value is %f\n", REAL(ans)[0]);
-    return(R_NilValue);
+    return R_NilValue;
 @}
 @end group
 @end example
@@ -9073,44 +9019,16 @@
 
 @findex .Call
 
-Let us convert our finite convolution example to use @code{.Call}, first
-using the @file{Rdefines.h} macros.  The calling function in @R{} is
+Let us convert our finite convolution example to use @code{.Call}.  The
+calling function in @R{} is
 
 @example
 conv <- function(a, b) .Call("convolve2", a, b)
 @end example
 
 @noindent
-which could hardly be simpler, but as we shall see all the type checking
-must be transferred to the C code, which is
-
-@example
-@group
-#include <R.h>
-#include <Rdefines.h>
-
-SEXP convolve2(SEXP a, SEXP b)
-@{
-    int i, j, na, nb, nab;
-    double *xa, *xb, *xab;
-    SEXP ab;
-
-    PROTECT(a = AS_NUMERIC(a));
-    PROTECT(b = AS_NUMERIC(b));
-    na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1;
-    PROTECT(ab = NEW_NUMERIC(nab));
-    xa = NUMERIC_POINTER(a); xb = NUMERIC_POINTER(b);
-    xab = NUMERIC_POINTER(ab);
-    for(i = 0; i < nab; i++) xab[i] = 0.0;
-    for(i = 0; i < na; i++)
-         for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
-    UNPROTECT(3);
-    return(ab);
-@}
-@end group
-@end example
-
-Now for the version in @file{Rinternals.h} style.  Only the C code changes.
+which could hardly be simpler, but as we shall see all the type
+coercion is transferred to the C code, which is
 
 @example
 @group
@@ -9119,28 +9037,24 @@
 
 SEXP convolve2(SEXP a, SEXP b)
 @{
-    int i, j, na, nb, nab;
+    int na, nb, nab;
     double *xa, *xb, *xab;
     SEXP ab;
 
-    PROTECT(a = coerceVector(a, REALSXP));
-    PROTECT(b = coerceVector(b, REALSXP));
+    a = PROTECT(coerceVector(a, REALSXP));
+    b = PROTECT(coerceVector(b, REALSXP));
     na = length(a); nb = length(b); nab = na + nb - 1;
-    PROTECT(ab = allocVector(REALSXP, nab));
-    xa = REAL(a); xb = REAL(b);
-    xab = REAL(ab);
-    for(i = 0; i < nab; i++) xab[i] = 0.0;
-    for(i = 0; i < na; i++)
-        for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
+    ab = PROTECT(allocVector(REALSXP, nab));
+    xa = REAL(a); xb = REAL(b); xab = REAL(ab);
+    for(int i = 0; i < nab; i++) xab[i] = 0.0;
+    for(int i = 0; i < na; i++)
+        for(int j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
     UNPROTECT(3);
-    return(ab);
+    return ab;
 @}
 @end group
 @end example
 
-@noindent
-This is called in exactly the same way.
-
 @node Calling .External, Missing and special values, Calling .Call, Interface functions .Call and .External
 @subsection Calling @code{.External}
 
@@ -9169,8 +9083,8 @@
     double *xa, *xb, *xab;
     SEXP a, b, ab;
 
-    PROTECT(a = coerceVector(CADR(args), REALSXP));
-    PROTECT(b = coerceVector(CADDR(args), REALSXP));
+    a = PROTECT(coerceVector(CADR(args), REALSXP));
+    b = PROTECT(coerceVector(CADDR(args), REALSXP));
     ...
 @}
 @end group
@@ -9260,7 +9174,7 @@
             Rprintf("[%d] '%s' R type\n", i+1, name);
        @}
     @}
-    return(R_NilValue);
+    return R_NilValue;
 @}
 @end group
 @end example
@@ -9304,8 +9218,8 @@
 @example
 @group
     ...
-  for(i = 0; i < na; i++)
-    for(j = 0; j < nb; j++)
+  for(int i = 0; i < na; i++)
+    for(int j = 0; j < nb; j++)
         if(ISNA(xa[i]) || ISNA(xb[j]) || ISNA(xab[i + j]))
             xab[i + j] = NA_REAL;
         else
@@ -9360,19 +9274,19 @@
 @group
 SEXP lapply(SEXP list, SEXP expr, SEXP rho)
 @{
-    int i, n = length(list);
+    int n = length(list);
     SEXP ans;
 
     if(!isNewList(list)) error("'list' must be a list");
     if(!isEnvironment(rho)) error("'rho' should be an environment");
-    PROTECT(ans = allocVector(VECSXP, n));
-    for(i = 0; i < n; i++) @{
+    ans = PROTECT(allocVector(VECSXP, n));
+    for(int i = 0; i < n; i++) @{
         defineVar(install("x"), VECTOR_ELT(list, i), rho);
         SET_VECTOR_ELT(ans, i, eval(expr, rho));
     @}
     setAttrib(ans, R_NamesSymbol, getAttrib(list, R_NamesSymbol));
     UNPROTECT(1);
-    return(ans);
+    return ans;
 @}
 @end group
 @end example
@@ -9387,21 +9301,21 @@
 @group
 SEXP lapply2(SEXP list, SEXP fn, SEXP rho)
 @{
-    int i, n = length(list);
+    int n = length(list);
     SEXP R_fcall, ans;
 
     if(!isNewList(list)) error("'list' must be a list");
     if(!isFunction(fn)) error("'fn' must be a function");
     if(!isEnvironment(rho)) error("'rho' should be an environment");
-    PROTECT(R_fcall = lang2(fn, R_NilValue));
-    PROTECT(ans = allocVector(VECSXP, n));
-    for(i = 0; i < n; i++) @{
+    R_fcall = PROTECT(lang2(fn, R_NilValue));
+    ans = PROTECT(allocVector(VECSXP, n));
+    for(int i = 0; i < n; i++) @{
         SETCADR(R_fcall, VECTOR_ELT(list, i));
         SET_VECTOR_ELT(ans, i, eval(R_fcall, rho));
     @}
     setAttrib(ans, R_NamesSymbol, getAttrib(list, R_NamesSymbol));
     UNPROTECT(2);
-    return(ans);
+    return ans;
 @}
 @end group
 @end example
@@ -9429,7 +9343,7 @@
        See do_docall for the template for this sort of thing.
     */
     SEXP s, t;
-    PROTECT(t = s = allocList(3));
+    t = s = PROTECT(allocList(3));
     SET_TYPEOF(s, LANGSXP);
     SETCAR(t, install("print")); t = CDR(t);
     SETCAR(t,  CAR(a)); t = CDR(t);
@@ -9490,7 +9404,7 @@
 SEXP mkans(double x)
 @{
     SEXP ans;
-    PROTECT(ans = allocVector(REALSXP, 1));
+    ans = PROTECT(allocVector(REALSXP, 1));
     REAL(ans)[0] = x;
     UNPROTECT(1);
     return ans;
@@ -9501,7 +9415,7 @@
 double feval(double x, SEXP f, SEXP rho)
 @{
     defineVar(install("x"), mkans(x), rho);
-    return(REAL(eval(f, rho))[0]);
+    return REAL(eval(f, rho))[0];
 @}
 @end group
 
@@ -9605,7 +9519,7 @@
 @{
     SEXP theta, expr, rho, ans, ans1, gradient, par, dimnames;
     double tt, xx, delta, eps = sqrt(DOUBLE_EPS), *rgr, *rans;
-    int start, i, j;
+    int i, start;
 @end group
 
 @group
@@ -9617,20 +9531,20 @@
 @end group
 
 @group
-    PROTECT(ans = coerceVector(eval(expr, rho), REALSXP));
-    PROTECT(gradient = allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
+    ans = PROTECT(coerceVector(eval(expr, rho), REALSXP));
+    gradient = PROTECT(allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
     rgr = REAL(gradient); rans = REAL(ans);
 @end group
 
 @group
     for(i = 0, start = 0; i < LENGTH(theta); i++, start += LENGTH(ans)) @{
-        PROTECT(par = findVar(install(CHAR(STRING_ELT(theta, i))), rho));
+        par = PROTECT(findVar(install(CHAR(STRING_ELT(theta, i))), rho));
         tt = REAL(par)[0];
         xx = fabs(tt);
         delta = (xx < 1) ? eps : xx*eps;
         REAL(par)[0] += delta;
-        PROTECT(ans1 = coerceVector(eval(expr, rho), REALSXP));
-        for(j = 0; j < LENGTH(ans); j++)
+        ans1 = PROTECT(coerceVector(eval(expr, rho), REALSXP));
+        for(int j = 0; j < LENGTH(ans); j++)
             rgr[j + start] = (REAL(ans1)[j] - rans[j])/delta;
         REAL(par)[0] = tt;
         UNPROTECT(2); /* par, ans1 */
@@ -9638,7 +9552,7 @@
 @end group
 
 @group
-    PROTECT(dimnames = allocVector(VECSXP, 2));
+    dimnames = PROTECT(allocVector(VECSXP, 2));
     SET_VECTOR_ELT(dimnames, 1,  theta);
     dimnamesgets(gradient, dimnames);
     setAttrib(ans, install("gradient"), gradient);
@@ -9671,14 +9585,14 @@
 environment @code{rho}, by
 
 @example
-    PROTECT(ans = coerceVector(eval(expr, rho), REALSXP));
+    ans = PROTECT(coerceVector(eval(expr, rho), REALSXP));
 @end example
 
 @noindent
 We then allocate space for the calculated derivative by
 
 @example
-    PROTECT(gradient = allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
+    gradient = PROTECT(allocMatrix(REALSXP, LENGTH(ans), LENGTH(theta)));
 @end example
 
 @noindent
@@ -9689,7 +9603,7 @@
 @example
 @group
     for(i = 0, start = 0; i < LENGTH(theta); i++, start += LENGTH(ans)) @{
-        PROTECT(par = findVar(install(CHAR(STRING_ELT(theta, i))), rho));
+        par = PROTECT(findVar(install(CHAR(STRING_ELT(theta, i))), rho));
 @end group
 @end example
 
@@ -9710,7 +9624,7 @@
         xx = fabs(tt);
         delta = (xx < 1) ? eps : xx*eps;
         REAL(par)[0] += delta;
-        PROTECT(ans1 = coerceVector(eval(expr, rho), REALSXP));
+        ans1 = PROTECT(coerceVector(eval(expr, rho), REALSXP));
 @end group
 @end example
 
@@ -9725,7 +9639,7 @@
 
 @example
 @group
-        for(j = 0; j < LENGTH(ans); j++)
+        for(int j = 0; j < LENGTH(ans); j++)
             rgr[j + start] = (REAL(ans1)[j] - rans[j])/delta;
         REAL(par)[0] = tt;
         UNPROTECT(2);
@@ -9739,7 +9653,7 @@
 
 @example
 @group
-    PROTECT(dimnames = allocVector(VECSXP, 2));
+    dimnames = PROTECT(allocVector(VECSXP, 2));
     SET_VECTOR_ELT(dimnames, 1, theta);
     dimnamesgets(gradient, dimnames);
     setAttrib(ans, install("gradient"), gradient);
@@ -9785,7 +9699,7 @@
     ParseStatus status;
    ...
     if(done == 1) @{
-        PROTECT(cmdSexp = allocVector(STRSXP, 1));
+        cmdSexp = PROTECT(allocVector(STRSXP, 1));
         SET_STRING_ELT(cmdSexp, 0, mkChar(cmd));
         cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
         if (status != PARSE_OK) @{
@@ -9989,7 +9903,7 @@
 
 @example
     SEXP ans, ptr;
-    PROTECT(ans = allocVector(INTSXP, 1));
+    ans = PROTECT(allocVector(INTSXP, 1));
     ptr = R_MakeExternalPtr(thisHandle, install("RODBC_channel"), R_NilValue);
     PROTECT(ptr);
     R_RegisterCFinalizerEx(ptr, chanFinalizer, TRUE);
@@ -10615,6 +10529,12 @@
 The standard packages, for example @pkg{stats}, are a rich source of
 further examples.
 
+Passing character strings from C to FORTRAN 77 or @emph{vice versa} is
+not portable (and to Fortran 90 or later is even less so).  We have
+found that it helps to ensure that a C string to be passed is followed
+by several @code{nul}s (and not just the one needed as a C terminator).
+But for maximal portability character strings in FORTRAN should be
+avoided.
 
 
 @node Numerical analysis subroutines, Optimization, Calling C from FORTRAN and vice versa, The R API
diff -ruN R-3.0.1/doc/manual/R-intro.texi R-patched/doc/manual/R-intro.texi
--- doc/manual/R-intro.texi	2013-04-03 18:05:07.000000000 -0400
+++ doc/manual/R-intro.texi	2013-05-24 18:05:06.000000000 -0400
@@ -84,7 +84,9 @@
 @top An Introduction to R
 
 This is an introduction to R (``GNU S''), a language and environment for
-statistical computing and graphics.  R is similar to the award-winning S
+statistical computing and graphics.  R is similar to the
+award-winning@footnote{ACM Software Systems award, 1998:
+@uref{http://awards.acm.org/award_winners/chambers_6640862.cfm}.} S
 system, which was developed at Bell Laboratories by John Chambers et al.
 It provides a wide variety of statistical and graphical techniques
 (linear and nonlinear modelling, statistical tests, time series
@@ -149,8 +151,8 @@
 and more importantly some instant feedback on what actually happens.
 
 Many users will come to @R{} mainly for its graphical facilities.
-@ref{Graphics} on the graphics facilities can be read at almost any time
-and need not wait until all the preceding sections have been digested.
+@xref{Graphics}, which can be read at almost any time and need not wait
+until all the preceding sections have been digested.
 
 @menu
 * Introduction and preliminaries::
@@ -1981,12 +1983,27 @@
 @node Matrix facilities, Forming partitioned matrices, Generalized transpose of an array, Arrays and matrices
 @section Matrix facilities
 
+@iftex
 @macro xTx{}
- @eqn{@strong{x}^T @strong{x}, x'x}
+@tex
+$@strong{x}^T @strong{x}$%
+@end tex
 @end macro
 @macro xxT{}
- @eqn{@strong{x}@strong{x}^T, x x'}
+@tex
+$@strong{x}@strong{x}^T$%
+@end tex
 @end macro
+@end iftex
+
+@ifnottex
+@macro xTx{}
+x'x
+@end macro
+@macro xxT{}
+x x'
+@end macro
+@end ifnottex
 
 As noted above, a matrix is just an array with two subscripts.  However
 it is such an important special case it needs a separate discussion.
@@ -2047,8 +2064,7 @@
 result.  The matrix @xxT{} may be calculated either by @code{cbind(x)
 %*% x} or @code{x %*% rbind(x)} since the result of @code{rbind()} or
 @code{cbind()} is always a matrix.  However, the best way to compute
-@xTx{} or @xxT{} is @code{crossprod(x)} or @code{x %o% x}
-respectively.}
+@xTx{} or @xxT{} is @code{crossprod(x)} or @code{x %o% x} respectively.}
 
 @findex crossprod
 The function @code{crossprod()} forms ``crossproducts'', meaning that
@@ -2103,13 +2119,13 @@
 potentially unstable to compute @code{x <- solve(A) %*% b} instead of
 @code{solve(A,b)}.
 
-The quadratic form @eqn{@strong{x^T  A^{-1} x},@ @code{x %*% A^@{-1@} %*%
+The quadratic form @eqn{@strong{x^T A^{-1} x},@ @code{x %*% A^@{-1@} %*%
 x} @ } which is used in multivariate computations, should be computed by
 something like@footnote{Even better would be to form a matrix square
-root @eqn{B, B} with @eqn{A = BB^T, A = BB'} and find the squared length of the
-solution of @eqn{By = x, By = x}, perhaps using the Cholesky or
-eigendecomposition of @eqn{A, A}.} @code{x %*% solve(A,x)}, rather than
-computing the inverse of @code{A}.
+root @eqn{B, B} with @eqn{A = BB^T, A = BB'} and find the squared length
+of the solution of @eqn{By = x, By = x} , perhaps using the Cholesky or
+eigen decomposition of @eqn{A, A}.  } @code{x %*% solve(A,x)}, rather
+than computing the inverse of @code{A}.
 
 @node Eigenvalues and eigenvectors, Singular value decomposition and determinants, Linear equations and inversion, Matrix facilities
 @subsection Eigenvalues and eigenvectors
@@ -2728,9 +2744,9 @@
 facilities are simple and their requirements are fairly strict and even
 rather inflexible.  There is a clear presumption by the designers of
 @R{} that you will be able to modify your input files using other tools,
-such as file editors or Perl@footnote{Under UNIX, the utilities Sed or
-Awk can be used.} to fit in with the requirements of @R{}.  Generally
-this is very simple.
+such as file editors or Perl@footnote{Under UNIX, the utilities
+@command{sed} or@command{awk} can be used.} to fit in with the
+requirements of @R{}.  Generally this is very simple.
 
 If variables are to be held mainly in data frames, as we strongly
 suggest they should be, an entire data frame can be read directly with
@@ -5340,13 +5356,15 @@
 display a wide variety of statistical graphs and also to build entirely
 new types of graph.
 
-The graphics facilities can be used in both interactive and batch modes, but in
-most cases, interactive use is more productive.  Interactive use is also
-easy because at startup time @R{} initiates a graphics @emph{device
-driver} which opens a special @emph{graphics window} for the display of
-interactive graphics.  Although this is done automatically, it is useful
-to know that the command used is @code{X11()} under UNIX,
-@code{windows()} under Windows and @code{quartz()} under OS X.
+The graphics facilities can be used in both interactive and batch modes,
+but in most cases, interactive use is more productive.  Interactive use
+is also easy because at startup time @R{} initiates a graphics
+@emph{device driver} which opens a special @emph{graphics window} for
+the display of interactive graphics.  Although this is done
+automatically, it may useful to know that the command used is
+@code{X11()} under UNIX, @code{windows()} under Windows and
+@code{quartz()} under OS X.  A new device can always be opened by
+@code{dev.new()}.
 
 Once the device driver is running, @R{} plotting commands can be used to
 produce a variety of graphical displays and to create entirely new kinds
diff -ruN R-3.0.1/share/licenses/license.db R-patched/share/licenses/license.db
--- share/licenses/license.db	2013-03-22 19:05:06.000000000 -0400
+++ share/licenses/license.db	2013-05-24 18:05:06.000000000 -0400
@@ -128,7 +128,7 @@
 Abbrev: BSD_2_clause
 OSI: open (http://opensource.org/licenses/BSD-2-Clause)
 FSF: free_and_GPLv3_compatible (http://www.gnu.org/licenses/license-list.html#FreeBSD)
-File: src/licenses/BSD_2_clause
+File: share/licenses/BSD_2_clause
 URL: http://opensource.org/licenses/BSD-2-Clause
 FOSS: yes
 Extensible: yes
@@ -138,7 +138,7 @@
 Abbrev: BSD_3_clause
 OSI: open (http://opensource.org/licenses/BSD-2-Clause)
 FSF: free_and_GPLv3_compatible (http://www.gnu.org/licenses/license-list.html#ModifiedBSD)
-File: src/licenses/BSD_3_clause
+File: share/licenses/BSD_3_clause
 URL: http://opensource.org/licenses/BSD-3-Clause
 FOSS: yes
 Extensible: yes
diff -ruN R-3.0.1/src/include/Rdefines.h R-patched/src/include/Rdefines.h
--- src/include/Rdefines.h	2012-04-15 18:05:02.000000000 -0400
+++ src/include/Rdefines.h	2013-05-26 18:05:04.000000000 -0400
@@ -1,6 +1,6 @@
 /*
  *  R : A Computer Language for Statistical Data Analysis
- *  Copyright (C) 1999-2007 The R Core Team.
+ *  Copyright (C) 1999-2013 The R Core Team.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU Lesser General Public License as published by
@@ -133,6 +133,7 @@
 #define SET_DIMNAMES(x, n)     	setAttrib(x, R_DimNamesSymbol, n)
 #define SET_LEVELS(x, l)       	setAttrib(x, R_LevelsSymbol, l)
 #define SET_NAMES(x, n)		setAttrib(x, R_NamesSymbol, n)
+/* These do not support long vectors */
 #define GET_LENGTH(x)		length(x)
 #define SET_LENGTH(x, n)	(x = lengthgets(x, n))
 
@@ -146,11 +147,25 @@
 
 #define s_object                SEXPREC
 #define S_EVALUATOR             /**/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
+
+/* These conflict with definitions in R_ext/Boolean.h,
+   but spatstat relies on them in a C file */
+#ifdef __cplusplus
+# ifndef R_EXT_BOOLEAN_H_
+#  ifndef TRUE
+#   define TRUE 1
+#  endif
+#  ifndef FALSE
+#   define FALSE 0
+#  endif
+# endif
+#else
+#  ifndef TRUE
+#   define TRUE 1
+#  endif
+#  ifndef FALSE
+#   define FALSE 0
+#  endif
 #endif
 
 #define COPY_TO_USER_STRING(x)	mkChar(x)
Files R-3.0.1/src/library/Recommended/foreign.tgz and R-patched/src/library/Recommended/foreign.tgz differ
Files R-3.0.1/src/library/Recommended/foreign_0.8-53.tar.gz and R-patched/src/library/Recommended/foreign_0.8-53.tar.gz differ
Files R-3.0.1/src/library/Recommended/foreign_0.8-54.tar.gz and R-patched/src/library/Recommended/foreign_0.8-54.tar.gz differ
Files R-3.0.1/src/library/Recommended/mgcv.tgz and R-patched/src/library/Recommended/mgcv.tgz differ
Files R-3.0.1/src/library/Recommended/mgcv_1.7-22.tar.gz and R-patched/src/library/Recommended/mgcv_1.7-22.tar.gz differ
Files R-3.0.1/src/library/Recommended/mgcv_1.7-23.tar.gz and R-patched/src/library/Recommended/mgcv_1.7-23.tar.gz differ
diff -ruN R-3.0.1/src/library/base/R/grep.R R-patched/src/library/base/R/grep.R
--- src/library/base/R/grep.R	2013-03-05 18:02:33.000000000 -0500
+++ src/library/base/R/grep.R	2013-05-16 18:05:04.000000000 -0400
@@ -302,6 +302,7 @@
                 stop("must have replacement values for matches")
             value <- rep_len(value, np)
         }
+        y <- y[pos]
         x[pos] <- paste0(sapply(y, `[`, 1L), value, sapply(y, `[`, 2L))
         return(x)
     }
diff -ruN R-3.0.1/src/library/base/man/sort.Rd R-patched/src/library/base/man/sort.Rd
--- src/library/base/man/sort.Rd	2013-03-05 18:02:35.000000000 -0500
+++ src/library/base/man/sort.Rd	2013-05-24 18:05:05.000000000 -0400
@@ -72,7 +72,7 @@
   are more than 10.)  Names are discarded for partial sorting.
 
   Method \code{"shell"} uses Shellsort (an \eqn{O(n^{4/3})} variant from
-  Sedgewick (1996)).  If \code{x} has names a stable modification is
+  Sedgewick (1986)).  If \code{x} has names a stable modification is
   used, so ties are not reordered.  (This only matters if names are
   present.)
 
diff -ruN R-3.0.1/src/library/grDevices/man/Japanese.Rd R-patched/src/library/grDevices/man/Japanese.Rd
--- src/library/grDevices/man/Japanese.Rd	2012-12-05 09:37:58.000000000 -0500
+++ src/library/grDevices/man/Japanese.Rd	2013-05-16 18:05:04.000000000 -0400
@@ -37,8 +37,8 @@
 par(cex = 3)
 Vf <- c("serif", "plain")
 % doubled "\" -> can't execute here!
-text(4, 2, "\\\\#J2438\\\\#J2421\\\\#J2451\\\\#J2473", vfont = Vf)
-text(4, 4, "\\\\#J2538\\\\#J2521\\\\#J2551\\\\#J2573", vfont = Vf)
+text(4, 2, "\\\\#J244b\\\\#J245b\\\\#J2473", vfont = Vf)
+text(4, 4, "\\\\#J2538\\\\#J2563\\\\#J2551\\\\#J2573", vfont = Vf)
 text(4, 6, "\\\\#J467c\\\\#J4b5c", vfont = Vf)
 text(4, 8, "Japan", vfont = Vf)
 par(cex = 1)
diff -ruN R-3.0.1/src/library/graphics/man/par.Rd R-patched/src/library/graphics/man/par.Rd
--- src/library/graphics/man/par.Rd	2013-03-05 18:02:29.000000000 -0500
+++ src/library/graphics/man/par.Rd	2013-05-24 18:05:04.000000000 -0400
@@ -729,10 +729,12 @@
    plot(0:1, 0:1, type = "n", axes = FALSE, ann = FALSE)
    y <- (n:1)/(n+1)
    clty <- as.character(ltys)
-   mytext <- function(x,y, txt) text(x, y, txt, adj = c(0, -.3), cex = 0.8, ...)
+   mytext <- function(x, y, txt)
+      text(x, y, txt, adj = c(0, -.3), cex = 0.8, ...)
    abline(h = y, lty = ltys, ...); mytext(xoff, y, clty)
    y <- y - 1/(3*(n+1))
-   abline(h = y, lty = ltys, lwd = 2, ...); mytext(1/8+xoff, y, paste(clty," lwd = 2"))
+   abline(h = y, lty = ltys, lwd = 2, ...)
+   mytext(1/8+xoff, y, paste(clty," lwd = 2"))
 }
 showLty(c("solid", "dashed", "dotted", "dotdash", "longdash", "twodash"))
 par(new = TRUE)  # the same:
Files R-3.0.1/src/library/grid/inst/doc/displaylist.pdf and R-patched/src/library/grid/inst/doc/displaylist.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/frame.pdf and R-patched/src/library/grid/inst/doc/frame.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/grid.pdf and R-patched/src/library/grid/inst/doc/grid.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/grobs.pdf and R-patched/src/library/grid/inst/doc/grobs.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/interactive.pdf and R-patched/src/library/grid/inst/doc/interactive.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/locndimn.pdf and R-patched/src/library/grid/inst/doc/locndimn.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/moveline.pdf and R-patched/src/library/grid/inst/doc/moveline.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/nonfinite.pdf and R-patched/src/library/grid/inst/doc/nonfinite.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/plotexample.pdf and R-patched/src/library/grid/inst/doc/plotexample.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/rotated.pdf and R-patched/src/library/grid/inst/doc/rotated.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/saveload.pdf and R-patched/src/library/grid/inst/doc/saveload.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/sharing.pdf and R-patched/src/library/grid/inst/doc/sharing.pdf differ
Files R-3.0.1/src/library/grid/inst/doc/viewports.pdf and R-patched/src/library/grid/inst/doc/viewports.pdf differ
diff -ruN R-3.0.1/src/library/methods/man/representation.Rd R-patched/src/library/methods/man/representation.Rd
--- src/library/methods/man/representation.Rd	2013-03-05 18:02:31.000000000 -0500
+++ src/library/methods/man/representation.Rd	2013-05-16 18:05:04.000000000 -0400
@@ -8,13 +8,15 @@
 \alias{prototype}
 \title{ Construct a Representation or a Prototype for a Class Definition}
 \description{
-  In calls to
-  \code{\link{setClass}}, these two functions construct,
-  respectively, the \code{representation} and \code{prototype}
-  arguments.  They do various checks and handle special cases.  You're
-  encouraged to use them when defining classes that, for
-  example, extend other classes as a data part or have multiple
-  superclasses, or that combine extending a class and slots.
+  These are old utility functions  to construct, respectively
+  a list designed to represent the slots and superclasses and
+  a list of prototype specifications.  The \code{representation()}
+  function is no longer useful, since the arguments \code{slots} and
+  \code{contains} to \code{\link{setClass}} are now recommended.
+
+  The \code{prototype()} function may still be used for the
+  corresponding argument, but a
+  simple list of the same arguments works as well.
 }
 \usage{
 representation(...)
diff -ruN R-3.0.1/src/library/methods/man/setClass.Rd R-patched/src/library/methods/man/setClass.Rd
--- src/library/methods/man/setClass.Rd	2013-03-05 18:02:31.000000000 -0500
+++ src/library/methods/man/setClass.Rd	2013-05-16 18:05:04.000000000 -0400
@@ -15,7 +15,7 @@
   is returned as the value of \code{setClass()}, suitable for creating
   objects from the class if the class is not virtual.  Of the many
   arguments to the function only \code{Class},
-  \code{representation} and \code{contains} are usually needed.
+  \code{slots=} and \code{contains=} are usually needed.
 }
 \usage{
 setClass(Class, representation, prototype, contains=character(),
diff -ruN R-3.0.1/src/library/methods/src/slot.c R-patched/src/library/methods/src/slot.c
--- src/library/methods/src/slot.c	2012-04-15 18:05:17.000000000 -0400
+++ src/library/methods/src/slot.c	2013-05-25 18:05:04.000000000 -0400
@@ -1,6 +1,6 @@
 /*
  *  R : A Computer Language for Statistical Data Analysis
- *  Copyright (C) 2001-2005   The R Core Team.
+ *  Copyright (C) 2001-2013   The R Core Team.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -18,7 +18,6 @@
  */
 
 #include <R.h>
-#include <Rdefines.h>
 #include <Rinternals.h>
 #include "methods.h"
 
Files R-3.0.1/src/library/parallel/inst/doc/parallel.pdf and R-patched/src/library/parallel/inst/doc/parallel.pdf differ
diff -ruN R-3.0.1/src/library/stats/R/median.R R-patched/src/library/stats/R/median.R
--- src/library/stats/R/median.R	2012-08-05 18:05:06.000000000 -0400
+++ src/library/stats/R/median.R	2013-05-24 18:05:04.000000000 -0400
@@ -21,8 +21,9 @@
 median.default <- function(x, na.rm = FALSE)
 {
     if(is.factor(x) || is.data.frame(x)) stop("need numeric data")
-    ## all other objects only need sort() & mean() to be working
+    ## all other objects only need is.na(), sort() & mean() to be working
     if(length(names(x))) names(x) <- NULL # for e.g., c(x = NA_real_)
+##    if(na.rm) x <- x[!is.na(x)] else if(anyNA(x)) return(x[FALSE][NA])
     if(na.rm) x <- x[!is.na(x)] else if(any(is.na(x))) return(x[FALSE][NA])
     n <- length(x)
     if (n == 0L) return(x[FALSE][NA])
diff -ruN R-3.0.1/src/library/stats/man/median.Rd R-patched/src/library/stats/man/median.Rd
--- src/library/stats/man/median.Rd	2013-03-05 18:02:25.000000000 -0500
+++ src/library/stats/man/median.Rd	2013-05-24 18:05:04.000000000 -0400
@@ -21,10 +21,11 @@
 }
 \details{
   This is a generic function for which methods can be written.  However,
-  the default method makes use of \code{sort} and \code{mean} from
-  package \pkg{base} both of which are generic, and so the default
-  method will work for most classes (e.g. \code{"\link{Date}"}) for
-  which a median is a reasonable concept.
+  the default method makes use of \code{is.na}, \code{sort} and
+  \code{mean} from package \pkg{base} all of which are generic, and so
+  the default method will work for most classes
+  (e.g. \code{"\link{Date}"}) for which a median is a reasonable
+  concept.
 }
 \value{
   The default method returns a length-one object of the same type as
diff -ruN R-3.0.1/src/library/stats/src/distance.c R-patched/src/library/stats/src/distance.c
--- src/library/stats/src/distance.c	2013-03-05 18:02:24.000000000 -0500
+++ src/library/stats/src/distance.c	2013-05-24 18:05:04.000000000 -0400
@@ -29,7 +29,7 @@
 #include <Rmath.h>
 #include <float.h>
 #include "stats.h"
-#ifdef HAVE_OPENMP
+#ifdef _OPENMP
 # include <R_ext/MathThreads.h>
 #endif
 
@@ -201,7 +201,7 @@
     int dc, i, j;
     size_t  ij;  /* can exceed 2^31 - 1 */
     double (*distfun)(double*, int, int, int, int) = NULL;
-#ifdef HAVE_OPENMP
+#ifdef _OPENMP
     int nthreads;
 #endif
 
@@ -229,7 +229,7 @@
 	error(_("distance(): invalid distance"));
     }
     dc = (*diag) ? 0 : 1; /* diag=1:  we do the diagonal */
-#ifdef HAVE_OPENMP
+#ifdef _OPENMP
     if (R_num_math_threads > 0)
 	nthreads = R_num_math_threads;
     else
diff -ruN R-3.0.1/src/library/tools/R/Rd2ex.R R-patched/src/library/tools/R/Rd2ex.R
--- src/library/tools/R/Rd2ex.R	2012-08-05 18:05:08.000000000 -0400
+++ src/library/tools/R/Rd2ex.R	2013-05-25 18:05:03.000000000 -0400
@@ -20,7 +20,7 @@
 
 Rd2ex <-
     function(Rd, out="", defines=.Platform$OS.type, stages="render",
-             outputEncoding="UTF-8", ...)
+             outputEncoding="UTF-8", commentDontrun = TRUE, ...)
 {
     encode_warn <- FALSE
     WriteLines <- function(x, con, outputEncoding, ...) {
@@ -73,21 +73,22 @@
                 writeLines("", con)
             of1("## End Don't show")
         } else if (tag  == "\\dontrun") {
-            ## Special case for one line.
-            if (length(x) == 1L) {
+            if (commentDontrun)
                 of1("## Not run: ")
+            ## Special case for one line.
+            if (length(x) == 1L && commentDontrun) {
                 render(x[[1L]], prefix)
             } else {
-                of1("## Not run: ")
                 if (!grepl("^\n", x[[1L]][1L], perl = TRUE) && RdTags(x)[1L] != "COMMENT") {
                     writeLines("", con)
-                    render(x[[1L]], paste("##D", prefix))
+                    render(x[[1L]], paste0(if (commentDontrun) "##D ", prefix))
                 } else render(x[[1L]], prefix)
-                for(i in 2:length(x)) render(x[[i]], paste("##D", prefix))
+                for(i in 2:length(x)) render(x[[i]], paste0(if (commentDontrun) "##D ", prefix))
                 last <- x[[length(x)]]
                 if (!grepl("\n$", last[length(last)], perl = TRUE))
                     writeLines("", con)
-                of1("## End(Not run)")
+                if (commentDontrun)
+                    of1("## End(Not run)")
             }
         } else if (tag  == "\\donttest") {
             of1("## No test: ")
diff -ruN R-3.0.1/src/library/tools/R/check.R R-patched/src/library/tools/R/check.R
--- src/library/tools/R/check.R	2013-04-22 18:05:03.000000000 -0400
+++ src/library/tools/R/check.R	2013-05-20 18:05:04.000000000 -0400
@@ -3313,9 +3313,10 @@
             "  -v, --version		print version info and exit",
             "  -l, --library=LIB     library directory used for test installation",
             "			of packages (default is outdir)",
-            "  -o, --outdir=DIR      directory used for logfiles, R output, etc.",
-            "			(default is 'pkg.Rcheck' in current directory,",
-            "			where 'pkg' is the name of the package checked)",
+            "  -o, --output=DIR      directory for output, default is current directory.",
+            "			Logfiles, R output, etc. will be placed in 'pkg.Rcheck'",
+            "			in this directory, where 'pkg' is the name of the",
+            "			checked package",
             "      --no-clean        do not clean 'outdir' before using it",
             "      --no-codoc        do not check for code/documentation mismatches",
             "      --no-examples     do not run the examples in the Rd files",
diff -ruN R-3.0.1/src/library/tools/man/Rd2HTML.Rd R-patched/src/library/tools/man/Rd2HTML.Rd
--- src/library/tools/man/Rd2HTML.Rd	2013-03-05 18:02:28.000000000 -0500
+++ src/library/tools/man/Rd2HTML.Rd	2013-05-25 18:05:03.000000000 -0400
@@ -30,7 +30,8 @@
          fragment = FALSE, ..., writeEncoding = TRUE)
 
 Rd2ex(Rd, out = "", defines = .Platform$OS.type,
-      stages = "render", outputEncoding = "UTF-8", ...)
+      stages = "render", outputEncoding = "UTF-8", 
+      commentDontrun = TRUE, ...)
 }
 \arguments{
   \item{Rd}{ a filename or \code{Rd} object to use as input. }
@@ -57,6 +58,8 @@
     \code{Rd} is a filename. }
   \item{writeEncoding}{should \verb{\inputencoding} lines be written in
       the file for non-ASCII encodings?}
+  \item{commentDontrun}{should \verb{\dontrun} sections be commented
+      out?}
 }
 \details{
   These functions convert help documents: \code{Rd2HTML} produces HTML,
diff -ruN R-3.0.1/src/library/tools/src/Makefile.in R-patched/src/library/tools/src/Makefile.in
--- src/library/tools/src/Makefile.in	2013-03-05 18:02:28.000000000 -0500
+++ src/library/tools/src/Makefile.in	2013-05-16 07:42:08.000000000 -0400
@@ -64,6 +64,6 @@
 $(srcdir)/gramLatex.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/gramLatex.y
 	@$(ECHO) "re-making gramLatex.c"
 	$(YACC) $(YFLAGS) $(srcdir)/gramLatex.y
-	$(SHELL) $(top_srcdir)/tools/move-if-change y.tab.c $(srcdir)/gramLatex.
+	$(SHELL) $(top_srcdir)/tools/move-if-change y.tab.c $(srcdir)/gramLatex.c
 
 ## Automagically generated dependencies:
diff -ruN R-3.0.1/src/library/utils/R/example.R R-patched/src/library/utils/R/example.R
--- src/library/utils/R/example.R	2012-08-05 18:05:07.000000000 -0400
+++ src/library/utils/R/example.R	2013-05-25 18:05:03.000000000 -0400
@@ -22,7 +22,8 @@
          character.only = FALSE, give.lines = FALSE, local = FALSE,
 	 echo = TRUE, verbose = getOption("verbose"), setRNG = FALSE,
          ask = getOption("example.ask"),
-	 prompt.prefix = abbreviate(topic, 6))
+	 prompt.prefix = abbreviate(topic, 6),
+	 run.dontrun = FALSE)
 {
     if (!character.only) {
         topic <- substitute(topic)
@@ -39,7 +40,7 @@
     pkgname <- basename(packagePath)
     lib <- dirname(packagePath)
     tf <- tempfile("Rex")
-    tools::Rd2ex(.getHelpFile(file), tf)
+    tools::Rd2ex(.getHelpFile(file), tf, commentDontrun = !run.dontrun)
     if (!file.exists(tf)) {
 	if(give.lines) return(character())
         warning(gettextf("%s has a help file but no examples", sQuote(topic)),
diff -ruN R-3.0.1/src/library/utils/R/help.request.R R-patched/src/library/utils/R/help.request.R
--- src/library/utils/R/help.request.R	2013-03-05 18:02:26.000000000 -0500
+++ src/library/utils/R/help.request.R	2013-05-16 18:05:04.000000000 -0400
@@ -1,7 +1,7 @@
 #  File src/library/utils/R/unix/help.request.R
 #  Part of the R package, http://www.R-project.org
 #
-#  Copyright (C) 1995-2012 The R Core Team
+#  Copyright (C) 1995-2013 The R Core Team
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -95,10 +95,9 @@
 	if(no(other)) return("Please do this first.")
     }
 
-    man <- url("http://cran.r-project.org/manuals.html")
-    ver <- scan(man, what = character(0L), sep = "\n", skip = 13L, nlines = 1L,
-		quiet = TRUE)
-    ver <- strsplit(ver, " ")[[1L]][3L]
+    page <- url("http://cran.r-project.org/bin/windows/base")
+    title <- grep("<title>", readLines(page, 10L), fixed = TRUE, value = TRUE)
+    ver <- sub("^.*R-([^ ]*) for Windows.*$", "\\1", title)
     if (getRversion() < numeric_version(ver)) {
 	update <- readMyLine("Your R version is out-of-date,",
 			     "would you like to update now?")
Files R-3.0.1/src/library/utils/inst/doc/Sweave.pdf and R-patched/src/library/utils/inst/doc/Sweave.pdf differ
diff -ruN R-3.0.1/src/library/utils/man/example.Rd R-patched/src/library/utils/man/example.Rd
--- src/library/utils/man/example.Rd	2012-12-05 09:37:55.000000000 -0500
+++ src/library/utils/man/example.Rd	2013-05-25 18:05:03.000000000 -0400
@@ -16,7 +16,8 @@
         character.only = FALSE, give.lines = FALSE, local = FALSE,
         echo = TRUE, verbose = getOption("verbose"),
         setRNG = FALSE, ask = getOption("example.ask"),
-        prompt.prefix = abbreviate(topic, 6))
+        prompt.prefix = abbreviate(topic, 6),
+        run.dontrun = FALSE)
 }
 \arguments{
   \item{topic}{name or literal character string: the online
@@ -53,6 +54,8 @@
     device and to any devices opened by the example code.}
   \item{prompt.prefix}{character; prefixes the prompt to be used if
     \code{echo = TRUE}.}
+  \item{run.dontrun}{logical indicating that \verb{\dontrun}
+    should be ignored.}
 }
 \value{
   The value of the last evaluated expression, unless \code{give.lines}
diff -ruN R-3.0.1/src/main/RNG.c R-patched/src/main/RNG.c
--- src/main/RNG.c	2013-03-18 19:05:08.000000000 -0400
+++ src/main/RNG.c	2013-05-24 18:05:05.000000000 -0400
@@ -441,7 +441,7 @@
 /* Choose a new kind of RNG.
  * Initialize its seed by calling the old RNG's unif_rand()
  */
-    if (newkind == -1) newkind = RNG_DEFAULT;
+    if (newkind == (RNGtype)-1) newkind = RNG_DEFAULT;
     switch(newkind) {
     case WICHMANN_HILL:
     case MARSAGLIA_MULTICARRY:
@@ -465,7 +465,7 @@
 {
     /* N01type is an enumeration type, so this will probably get
        mapped to an unsigned integer type. */
-    if (kind == -1) kind = N01_DEFAULT;
+    if (kind == (N01type)-1) kind = N01_DEFAULT;
     if (kind > KINDERMAN_RAMAGE)
 	error(_("invalid Normal type in 'RNGkind'"));
     if (kind == USER_NORM) {
diff -ruN R-3.0.1/src/main/array.c R-patched/src/main/array.c
--- src/main/array.c	2013-04-19 18:05:04.000000000 -0400
+++ src/main/array.c	2013-05-24 18:05:05.000000000 -0400
@@ -1267,7 +1267,7 @@
 
     if (OP == 0 || OP == 1) { /* columns */
 	PROTECT(ans = allocVector(REALSXP, p));
-#ifdef HAVE_OPENMP
+#ifdef _OPENMP
 	int nthreads;
 	/* This gives a spurious -Wunused-but-set-variable error */
 	if (R_num_math_threads > 0)
diff -ruN R-3.0.1/src/main/platform.c R-patched/src/main/platform.c
--- src/main/platform.c	2013-04-15 18:05:05.000000000 -0400
+++ src/main/platform.c	2013-05-16 18:05:04.000000000 -0400
@@ -830,10 +830,16 @@
     for (i = 0; i < n; i++) {
 #ifdef Win32
 	wchar_t *wfn = filenameToWchar(STRING_ELT(fn, i), TRUE);
-	/* 'Sharpie' and fellow ignorami use trailing / on Windows,
-	   where it is not valid */
-	wchar_t *p = wfn + (wcslen(wfn) - 1);
-	if (*p == L'/' || *p == L'\\') *p = 0;
+	/* trailing \ is not valid on Windows except for the
+	   root directory on a drive, specified as "\", or "D:\",
+	   or "\\?\D:\", etc.  We remove it in other cases,
+	   to help those who think they're on Unix. */
+	size_t len = wcslen(wfn);
+	if (len) {
+	    wchar_t *p = wfn + (len - 1);
+            if (len > 1 && (*p == L'/' || *p == L'\\') &&
+            	*(p-1) != L':') *p = 0;
+        }
 #else
 	const char *efn = R_ExpandFileName(translateChar(STRING_ELT(fn, i)));
 #endif
diff -ruN R-3.0.1/src/scripts/config R-patched/src/scripts/config
--- src/scripts/config	2013-04-18 18:05:05.000000000 -0400
+++ src/scripts/config	2013-05-18 18:05:03.000000000 -0400
@@ -20,7 +20,7 @@
 ## A copy of the GNU General Public License is available at
 ## http://www.r-project.org/Licenses/
 
-revision='$Revision: 1.1 $'
+revision='$Revision: 1.1 $'
 version=`set - ${revision}; echo ${2}`
 version="R configuration information retrieval script: ${R_VERSION} (r${version})
 
@@ -219,7 +219,7 @@
       makefiles="${makefiles} -f ${HOME}/.R/Makevars"
     fi
   else
-    . ${R_HOME}/etc/Renviron
+    . ${R_HOME}/etc${R_ARCH}/Renviron
     if test -n "${R_MAKEVARS_USER}"; then
       makefiles="${makefiles} -f ${R_MAKEVARS_USER}"
     elif test -f "${HOME}/.R/Makevars-${R_PLATFORM}"; then
diff -ruN R-3.0.1/tests/Examples/datasets-Ex.Rout.save R-patched/tests/Examples/datasets-Ex.Rout.save
--- tests/Examples/datasets-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/datasets-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -3434,8 +3434,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  1.83 0.038 1.874 0 0 
+Time elapsed:  1.864 0.034 1.905 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/grDevices-Ex.Rout.save R-patched/tests/Examples/grDevices-Ex.Rout.save
--- tests/Examples/grDevices-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/grDevices-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -115,8 +115,8 @@
 +      main = "example(Japanese)", xlab = "using Hershey fonts")
 > par(cex = 3)
 > Vf <- c("serif", "plain")
-> text(4, 2, "\\#J2438\\#J2421\\#J2451\\#J2473", vfont = Vf)
-> text(4, 4, "\\#J2538\\#J2521\\#J2551\\#J2573", vfont = Vf)
+> text(4, 2, "\\#J244b\\#J245b\\#J2473", vfont = Vf)
+> text(4, 4, "\\#J2538\\#J2563\\#J2551\\#J2573", vfont = Vf)
 > text(4, 6, "\\#J467c\\#J4b5c", vfont = Vf)
 > text(4, 8, "Japan", vfont = Vf)
 > par(cex = 1)
@@ -3705,8 +3705,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  8.757 0.186 8.972 0 0 
+Time elapsed:  8.732 0.198 8.968 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/graphics-Ex.Rout.save R-patched/tests/Examples/graphics-Ex.Rout.save
--- tests/Examples/graphics-Ex.Rout.save	2013-05-02 18:05:04.000000000 -0400
+++ tests/Examples/graphics-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 Patched (2013-05-01 r62701) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -1622,10 +1622,12 @@
 +    plot(0:1, 0:1, type = "n", axes = FALSE, ann = FALSE)
 +    y <- (n:1)/(n+1)
 +    clty <- as.character(ltys)
-+    mytext <- function(x,y, txt) text(x, y, txt, adj = c(0, -.3), cex = 0.8, ...)
++    mytext <- function(x, y, txt)
++       text(x, y, txt, adj = c(0, -.3), cex = 0.8, ...)
 +    abline(h = y, lty = ltys, ...); mytext(xoff, y, clty)
 +    y <- y - 1/(3*(n+1))
-+    abline(h = y, lty = ltys, lwd = 2, ...); mytext(1/8+xoff, y, paste(clty," lwd = 2"))
++    abline(h = y, lty = ltys, lwd = 2, ...)
++    mytext(1/8+xoff, y, paste(clty," lwd = 2"))
 + }
 > showLty(c("solid", "dashed", "dotted", "dotdash", "longdash", "twodash"))
 > par(new = TRUE)  # the same:
@@ -2025,7 +2027,7 @@
 > points.default # to see how it calls "plot.xy(xy.coords(x, y), ...)"
 function (x, y = NULL, type = "p", ...) 
 plot.xy(xy.coords(x, y), type = type, ...)
-<bytecode: 0x3f8a6b8>
+<bytecode: 0x3b03758>
 <environment: namespace:graphics>
 > 
 > 
@@ -2925,7 +2927,7 @@
     u <- par("usr")
     xy * c(u[2L] - u[1L], u[4L] - u[3L])/par("pin")
 }
-<bytecode: 0x4773828>
+<bytecode: 0x4755578>
 <environment: namespace:graphics>
 > 
 > ## plot labels offset 0.12 inches to the right
@@ -3005,7 +3007,7 @@
 > ###
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  7.676 0.165 7.975 0 0 
+Time elapsed:  3.625 0.055 3.69 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/grid-Ex.Rout.save R-patched/tests/Examples/grid-Ex.Rout.save
--- tests/Examples/grid-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/grid-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -1960,8 +1960,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  1.44 0.026 1.472 0 0 
+Time elapsed:  1.393 0.019 1.417 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/splines-Ex.Rout.save R-patched/tests/Examples/splines-Ex.Rout.save
--- tests/Examples/splines-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/splines-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -612,8 +612,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  1.443 0.013 1.462 0 0 
+Time elapsed:  1.422 0.023 1.451 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/stats-Ex.Rout.save R-patched/tests/Examples/stats-Ex.Rout.save
--- tests/Examples/stats-Ex.Rout.save	2013-04-04 18:05:03.000000000 -0400
+++ tests/Examples/stats-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 Patched (2013-04-04 r62492) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -3713,7 +3713,7 @@
 > 
 > asOneSidedFormula("age")
 ~age
-<environment: 0x45ca580>
+<environment: 0x3b883b8>
 > asOneSidedFormula(~ age)
 ~age
 > 
@@ -4714,7 +4714,7 @@
     r[cbind(1L:p, 1L:p)] <- 1
     r
 }
-<bytecode: 0x7542ac8>
+<bytecode: 0x7166e98>
 <environment: namespace:stats>
 > stopifnot(all.equal(Cl, cov2cor(cov(longley))),
 +           all.equal(cor(longley, method = "kendall"),
@@ -6731,8 +6731,8 @@
 > gf$linkinv
 function (eta) 
 1/eta
-<bytecode: 0x49b50a8>
-<environment: 0x9e6a100>
+<bytecode: 0x3b63990>
+<environment: 0x89f5328>
 > gf$variance(-3:4) #- == (.)^2
 [1]  9  4  1  0  1  4  9 16
 > 
@@ -7133,7 +7133,7 @@
 > environment(as.formula("y ~ x"))
 <environment: R_GlobalEnv>
 > environment(as.formula("y ~ x", env = new.env()))
-<environment: 0xa03f7b0>
+<environment: 0x8ad7090>
 > 
 > 
 > ## Create a formula for a model with a large number of variables:
@@ -11709,26 +11709,26 @@
 $linkfun
 function (mu) 
 mu
-<bytecode: 0x49b2298>
-<environment: 0x97631a8>
+<bytecode: 0x3b61340>
+<environment: 0xa483b80>
 
 $linkinv
 function (eta) 
 eta
-<bytecode: 0x49b2228>
-<environment: 0x97631a8>
+<bytecode: 0x3b612d0>
+<environment: 0xa483b80>
 
 $mu.eta
 function (eta) 
 rep.int(1, length(eta))
-<bytecode: 0x49b21b8>
-<environment: 0x97631a8>
+<bytecode: 0x3b61260>
+<environment: 0xa483b80>
 
 $valideta
 function (eta) 
 TRUE
-<bytecode: 0x49b1ff8>
-<environment: 0x97631a8>
+<bytecode: 0x3b610a0>
+<environment: 0xa483b80>
 
 $name
 [1] "identity"
@@ -11739,14 +11739,14 @@
 $linkfun
 function (mu) 
 mu^lambda
-<bytecode: 0x9b36060>
-<environment: 0x9cff078>
+<bytecode: 0xa485138>
+<environment: 0xa431038>
 
 $linkinv
 function (eta) 
 pmax(eta^(1/lambda), .Machine$double.eps)
-<bytecode: 0x9ae7638>
-<environment: 0x9cff078>
+<bytecode: 0xa485288>
+<environment: 0xa431038>
 
 > 
 > 
@@ -15540,8 +15540,8 @@
 > unclass(sfun0)
 function (v) 
 .approxfun(x, y, v, method, yleft, yright, f)
-<bytecode: 0x4486820>
-<environment: 0x9b6c3f0>
+<bytecode: 0x3d223d0>
+<environment: 0x9ecb258>
 attr(,"call")
 stepfun(1:3, y0, f = 0)
 > ls(envir = environment(sfun0))
@@ -17793,7 +17793,7 @@
 > ###
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  14.992 0.275 15.886 0 0 
+Time elapsed:  7.265 0.173 7.469 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/stats4-Ex.Rout.save R-patched/tests/Examples/stats4-Ex.Rout.save
--- tests/Examples/stats4-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/stats4-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -182,8 +182,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  0.465 0.004 0.471 0 0 
+Time elapsed:  0.424 0.005 0.431 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/Examples/tools-Ex.Rout.save R-patched/tests/Examples/tools-Ex.Rout.save
--- tests/Examples/tools-Ex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/Examples/tools-Ex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -100,7 +100,7 @@
 $enumFormat
 function (n) 
 sprintf("%d. ", n)
-<environment: 0x382b150>
+<environment: 0x2d47fe0>
 
 $showURLs
 [1] FALSE
@@ -134,7 +134,7 @@
 $enumFormat
 function (n) 
 sprintf("%d. ", n)
-<environment: 0x382b150>
+<environment: 0x2d47fe0>
 
 $showURLs
 [1] FALSE
@@ -168,7 +168,7 @@
 $enumFormat
 function (n) 
 sprintf("%d. ", n)
-<environment: 0x382b150>
+<environment: 0x2d47fe0>
 
 $showURLs
 [1] FALSE
@@ -232,7 +232,7 @@
 > bibstyle("unsorted", sortKeys = function(refs) seq_along(refs),
 +     fmtPrefix = function(paper) paste0("[", paper$.index, "]"),
 +        .init = TRUE)
-<environment: 0x3750a78>
+<environment: 0x2d29810>
 > print(refs, .bibstyle = "unsorted")
 [1] R Core Team (2013). _R: A Language and Environment for Statistical
 Computing_. R Foundation for Statistical Computing, Vienna, Austria.
@@ -906,7 +906,7 @@
 > flush(stderr()); flush(stdout())
 > 
 > ### Name: vignetteEngine
-> ### Title: Set or get a vignette processing engine.
+> ### Title: Set or Get a Vignette Processing Engine
 > ### Aliases: vignetteEngine
 > ### Keywords: utilities documentation
 > 
@@ -962,8 +962,9 @@
 > 
 > ### * <FOOTER>
 > ###
+> options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  0.311 0.014 0.326 0 0 
+Time elapsed:  0.342 0.007 0.35 0 0 
 > grDevices::dev.off()
 null device 
           1 
diff -ruN R-3.0.1/tests/any-all.Rout.save R-patched/tests/any-all.Rout.save
--- tests/any-all.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/any-all.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/arith-true.Rout.save R-patched/tests/arith-true.Rout.save
--- tests/arith-true.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/arith-true.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -323,5 +323,5 @@
 > 
 > ## Last Line:
 > cat('Time elapsed: ', proc.time() - .proctime00,'\n')
-Time elapsed:  0.241 0.002 0.243 0 0 
+Time elapsed:  0.24 0.004 0.245 0 0 
 > 
diff -ruN R-3.0.1/tests/arith.Rout.save R-patched/tests/arith.Rout.save
--- tests/arith.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/arith.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/array-subset.Rout.save R-patched/tests/array-subset.Rout.save
--- tests/array-subset.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/array-subset.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/complex.Rout.save R-patched/tests/complex.Rout.save
--- tests/complex.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/complex.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/d-p-q-r-tests.Rout.save R-patched/tests/d-p-q-r-tests.Rout.save
--- tests/d-p-q-r-tests.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/d-p-q-r-tests.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -1315,5 +1315,5 @@
 > 
 > 
 > cat("Time elapsed: ", proc.time() - .ptime,"\n")
-Time elapsed:  0.83 0.002 0.835 0 0 
+Time elapsed:  0.847 0.008 0.857 0 0 
 > 
diff -ruN R-3.0.1/tests/datasets.Rout.save R-patched/tests/datasets.Rout.save
--- tests/datasets.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/datasets.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/demos.Rout.save R-patched/tests/demos.Rout.save
--- tests/demos.Rout.save	2013-04-26 18:05:04.000000000 -0400
+++ tests/demos.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -115,8 +115,8 @@
 +     "\n\t starting with 'is.' :\t  ",
 +     sum(grepl("^is\\.", ls.base[base.is.f])), "\n", sep = "")
 
-Number of base objects:		1265
-Number of functions in base:	1223
+Number of base objects:		1264
+Number of functions in base:	1222
 	 starting with 'is.' :	  49
 
 > ## 0.14  : 31
diff -ruN R-3.0.1/tests/eval-etc.Rout.save R-patched/tests/eval-etc.Rout.save
--- tests/eval-etc.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/eval-etc.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/iec60559.Rout.save R-patched/tests/iec60559.Rout.save
--- tests/iec60559.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/iec60559.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/internet.Rout.save R-patched/tests/internet.Rout.save
--- tests/internet.Rout.save	2013-04-03 03:00:03.000000000 -0400
+++ tests/internet.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-04-02 r62479) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -29,7 +29,7 @@
 > 
 > # test do_download.
 > nrow(available.packages(contrib.url("http://cran.r-project.org")))
-[1] 4407
+[1] 4538
 > 
 > # test url connections on http
 > zz <- url("http://cran.r-project.org/")
diff -ruN R-3.0.1/tests/lapack.Rout.save R-patched/tests/lapack.Rout.save
--- tests/lapack.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/lapack.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/lm-tests.Rout.save R-patched/tests/lm-tests.Rout.save
--- tests/lm-tests.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/lm-tests.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/method-dispatch.Rout.save R-patched/tests/method-dispatch.Rout.save
--- tests/method-dispatch.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/method-dispatch.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/ok-errors.Rout.save R-patched/tests/ok-errors.Rout.save
--- tests/ok-errors.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/ok-errors.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/print-tests.Rout.save R-patched/tests/print-tests.Rout.save
--- tests/print-tests.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/print-tests.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/reg-IO.Rout.save R-patched/tests/reg-IO.Rout.save
--- tests/reg-IO.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/reg-IO.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/reg-IO2.Rout.save R-patched/tests/reg-IO2.Rout.save
--- tests/reg-IO2.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/reg-IO2.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/reg-S4.Rout.save R-patched/tests/reg-S4.Rout.save
--- tests/reg-S4.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/reg-S4.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/reg-plot.Rout.save R-patched/tests/reg-plot.Rout.save
--- tests/reg-plot.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/reg-plot.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/reg-tests-2.R R-patched/tests/reg-tests-2.R
--- tests/reg-tests-2.R	2013-04-30 18:05:03.000000000 -0400
+++ tests/reg-tests-2.R	2013-05-16 18:05:05.000000000 -0400
@@ -2695,4 +2695,11 @@
 
 ## PR#15299 : adding a simple vector to a classed object produced a bad result:
 1:2 + table(1:2)
-## Printed the class attribute in R <= 3.0.0
\ No newline at end of file
+## Printed the class attribute in R <= 3.0.0
+
+## PR#15311 : regmatches<- mishandled regexpr results.
+  x <- c('1', 'B', '3')
+  m <- regexpr('\\d', x)
+  regmatches(x, m) <- c('A', 'C')
+  print(x)
+## Gave a warning and a wrong result up to 3.0.1
\ No newline at end of file
diff -ruN R-3.0.1/tests/reg-tests-2.Rout.save R-patched/tests/reg-tests-2.Rout.save
--- tests/reg-tests-2.Rout.save	2013-04-30 18:05:03.000000000 -0400
+++ tests/reg-tests-2.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 Patched (2013-04-04 r62492) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -6397,15 +6397,15 @@
 > print.function
 function (x, ...)  
  - attr(*, "srcref")=Class 'srcref'  atomic [1:8] 1 19 1 63 19 63 1 1
-  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x3c66fe8> 
+  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x4c9d128> 
 > f
 function ()  
  - attr(*, "srcref")=Class 'srcref'  atomic [1:8] 1 17 1 28 17 28 1 1
-  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x3c46db0> 
+  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x4c72208> 
  - attr(*, "note")= chr "just a note"
  - attr(*, "yada")=function ()  
   ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 2 24 2 48 24 48 2 2
-  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x3c46db0> 
+  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x4c72208> 
 > rm(print.function)
 > ## auto-printing and printing differed up to R 2.9.x
 > 
@@ -7067,3 +7067,11 @@
 2 3 
 > ## Printed the class attribute in R <= 3.0.0
 > 
+> ## PR#15311 : regmatches<- mishandled regexpr results.
+>   x <- c('1', 'B', '3')
+>   m <- regexpr('\\d', x)
+>   regmatches(x, m) <- c('A', 'C')
+>   print(x)
+[1] "A" "B" "C"
+> ## Gave a warning and a wrong result up to 3.0.1
+> 
diff -ruN R-3.0.1/tests/reg-tests-3.Rout.save R-patched/tests/reg-tests-3.Rout.save
--- tests/reg-tests-3.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/reg-tests-3.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
diff -ruN R-3.0.1/tests/simple-true.Rout.save R-patched/tests/simple-true.Rout.save
--- tests/simple-true.Rout.save	2013-03-30 19:05:05.000000000 -0400
+++ tests/simple-true.Rout.save	2013-05-24 18:05:05.000000000 -0400
@@ -1,5 +1,5 @@
 
-R version 3.0.0 RC (2013-03-29 r62438) -- "Masked Marvel"
+R version 3.0.1 Patched (2013-05-24 r62792) -- "Good Sport"
 Copyright (C) 2013 The R Foundation for Statistical Computing
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
