Commit 4b891963 authored by Dirk Eddelbuettel's avatar Dirk Eddelbuettel

New upstream version 3.4.4.20180411

parent b370a74c
Revision: 74529
Last Changed Date: 2018-04-04
Revision: 74578
Last Changed Date: 2018-04-10
3.5.0 alpha
3.5.0 beta
......@@ -28338,8 +28338,8 @@ $as_echo "$ac_res" >&6; }
fi
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative}; do
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} -std=sun${alternative}; do
cachevar=`$as_echo "ax_cv_cxx_compile_cxx98_$switch" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++98 features with $switch" >&5
$as_echo_n "checking whether $CXX supports C++98 features with $switch... " >&6; }
......@@ -28819,8 +28819,8 @@ $as_echo "$ac_res" >&6; }
fi
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative}; do
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} -std=sun${alternative}; do
cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
......@@ -29678,8 +29678,8 @@ $as_echo "$ac_res" >&6; }
fi
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative}; do
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} -std=sun${alternative}; do
cachevar=`$as_echo "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5
$as_echo_n "checking whether $CXX supports C++14 features with $switch... " >&6; }
......@@ -31024,8 +31024,8 @@ $as_echo "$ac_res" >&6; }
fi
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative}; do
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} -std=sun${alternative}; do
cachevar=`$as_echo "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5
$as_echo_n "checking whether $CXX supports C++17 features with $switch... " >&6; }
......@@ -266,7 +266,7 @@ CHANGES IN R 3.5.0:
* The environment variable R_MAX_VSIZE can now be used to specify
the maximal vector heap size. On macOS, unless specified by this
environment variable, the maximal vector heap size is set to the
maximum on 16GB and the available physical memory. This is to
maximum of 16GB and the available physical memory. This is to
avoid having the R process killed when macOS over-commits memory.
* sum(x) and sum(x1,x2,..,x<N>) with many or long logical or
......@@ -316,8 +316,8 @@ CHANGES IN R 3.5.0:
serialization magic numbers (RDA3, RDB3, RDX3). Format 3 can be
selected by version = 3 in save(), serialize() and saveRDS(), but
format 2 remains the default for all serialization and saving of
the workspace. Serialized data in format 3 cannot be read in R
prior to version 3.5.0.
the workspace. Serialized data in format 3 cannot be read by
versions of R prior to version 3.5.0.
* The "Date" and "date-time" classes "POSIXlt" and "POSIXct" now
have a working `length<-` method, as wished in PR#17387.
......@@ -326,6 +326,10 @@ CHANGES IN R 3.5.0:
turn off the warning when applying the default "Nelder-Mead"
method to 1-dimensional problems.
* matplot(.., panel.first = .) etc now work, as log becomes
explicit argument and ... is passed to plot() unevaluated, as
suggested by Sebastian Meyer in PR#17386.
UTILITIES:
* install.packages() for source packages now has the possibility to
......@@ -365,9 +369,10 @@ CHANGES IN R 3.5.0:
* C99 functions expm1, hypot, log1p and nearbyint are now required.
* configure sets the -std flag for the C++ compiler for all
supported C++ standards (e.g., -std=gnu++11 for the C++11
compiler).
* configure sets a -std flag for the C++ compiler for all supported
C++ standards (e.g., -std=gnu++11 for the C++11 compiler).
Previously this was not done in a few cases where the default
standard passed the tests made (e.g. clang 6.0.0 for C++11).
C-LEVEL FACILITIES:
......@@ -577,9 +582,15 @@ CHANGES IN R 3.5.0:
R CMD check warnings.
* match.arg() more carefully chooses the environment for
constucting default choices, fixing PR#17401 as proposed by
constructing default choices, fixing PR#17401 as proposed by
Duncan Murdoch.
* Deparsing of consecutive ! calls is now consistent with deparsing
unary - and + calls and creates code that can be reparsed
exactly; thanks to a patch by Lionel Henry in PR#17397. (As a
side effect, this uses fewer parentheses in some other deparsing
involving ! calls.)
CHANGES IN R 3.4.4:
NEW FEATURES:
......
......@@ -297,7 +297,7 @@
\item The environment variable \env{R_MAX_VSIZE} can now be used
to specify the maximal vector heap size. On macOS, unless specified
by this environment variable, the maximal vector heap size is set to
the maximum on 16GB and the available physical memory. This is to
the maximum of 16GB and the available physical memory. This is to
avoid having the \command{R} process killed when macOS over-commits
memory.
......@@ -342,17 +342,18 @@
row names \code{rNms} are handled. \code{.rowNamesDF()} is a
\dQuote{workaround} compatible default.
\item R has new serialization format (version 3) which supports custom
serialization of \code{ALTREP} framework objects. These objects can
still be serialized in format 2, but less efficiently. Serialization
format 3 also records the current native encoding of unflagged strings
and converts them when de-serialized in R running under different
native encoding. Format 3 comes with new serialization magic numbers
(RDA3, RDB3, RDX3). Format 3 can be selected by \code{version = 3} in
\code{save()}, \code{serialize()} and \code{saveRDS()}, but format 2
remains the default for all serialization and saving of the workspace.
Serialized data in format 3 cannot be read in \R prior to version
3.5.0.
\item R has new serialization format (version 3) which supports
custom serialization of \code{ALTREP} framework objects. These
objects can still be serialized in format 2, but less efficiently.
Serialization format 3 also records the current native encoding of
unflagged strings and converts them when de-serialized in R
running under different native encoding. Format 3 comes with new
serialization magic numbers (RDA3, RDB3, RDX3). Format 3 can be
selected by \code{version = 3} in \code{save()},
\code{serialize()} and \code{saveRDS()}, but format 2 remains the
default for all serialization and saving of the workspace.
Serialized data in format 3 cannot be read by versions of \R prior
to version 3.5.0.
\item The \code{"Date"} and \dQuote{date-time} classes
\code{"POSIXlt"} and \code{"POSIXct"} now have a working
......@@ -361,6 +362,10 @@
\item \code{optim(*, control = list(warn.1d.NelderMead = FALSE))}
allows to turn off the warning when applying the default
\code{"Nelder-Mead"} method to 1-dimensional problems.
\item \code{matplot(.., panel.first = .)} etc now work, as
\code{log} becomes explicit argument and \code{...} is passed to
\code{plot()} unevaluated, as suggested by Sebastian Meyer in \PR{17386}.
}
}
......@@ -410,9 +415,11 @@
\item C99 functions \code{expm1}, \code{hypot}, \code{log1p} and
\code{nearbyint} are now required.
\item \command{configure} sets the \option{-std} flag for the C++
\item \command{configure} sets a \option{-std} flag for the C++
compiler for all supported C++ standards (e.g., \option{-std=gnu++11}
for the C++11 compiler).
for the C++11 compiler). Previously this was not done in a few
cases where the default standard passed the tests made
(e.g.\sspace\command{clang 6.0.0} for C++11).
}
}
......@@ -640,8 +647,14 @@
no longer produces \command{R CMD check} warnings.
\item \code{match.arg()} more carefully chooses the environment
for constucting default \code{choices}, fixing \PR{17401} as
for constructing default \code{choices}, fixing \PR{17401} as
proposed by Duncan Murdoch.
\item Deparsing of consecutive \code{!} calls is now consistent
with deparsing unary \code{-} and \code{+} calls and creates code
that can be reparsed exactly; thanks to a patch by Lionel Henry in
\PR{17397}. (As a side effect, this uses fewer parentheses in
some other deparsing involving \code{!} calls.)
}
}
}
......
No preview for this file type
......@@ -368,7 +368,7 @@ expressions in one call.
<li><p> The environment variable <span class="env">R_MAX_VSIZE</span> can now be used
to specify the maximal vector heap size. On macOS, unless specified
by this environment variable, the maximal vector heap size is set to
the maximum on 16GB and the available physical memory. This is to
the maximum of 16GB and the available physical memory. This is to
avoid having the <code>R</code> process killed when macOS over-commits
memory.
</p>
......@@ -423,17 +423,18 @@ row names <code>rNms</code> are handled. <code>.rowNamesDF()</code> is a
&ldquo;workaround&rdquo; compatible default.
</p>
</li>
<li><p> R has new serialization format (version 3) which supports custom
serialization of <code>ALTREP</code> framework objects. These objects can
still be serialized in format 2, but less efficiently. Serialization
format 3 also records the current native encoding of unflagged strings
and converts them when de-serialized in R running under different
native encoding. Format 3 comes with new serialization magic numbers
(RDA3, RDB3, RDX3). Format 3 can be selected by <code>version = 3</code> in
<code>save()</code>, <code>serialize()</code> and <code>saveRDS()</code>, but format 2
remains the default for all serialization and saving of the workspace.
Serialized data in format 3 cannot be read in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> prior to version
3.5.0.
<li><p> R has new serialization format (version 3) which supports
custom serialization of <code>ALTREP</code> framework objects. These
objects can still be serialized in format 2, but less efficiently.
Serialization format 3 also records the current native encoding of
unflagged strings and converts them when de-serialized in R
running under different native encoding. Format 3 comes with new
serialization magic numbers (RDA3, RDB3, RDX3). Format 3 can be
selected by <code>version = 3</code> in <code>save()</code>,
<code>serialize()</code> and <code>saveRDS()</code>, but format 2 remains the
default for all serialization and saving of the workspace.
Serialized data in format 3 cannot be read by versions of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> prior
to version 3.5.0.
</p>
</li>
<li><p> The <code>"Date"</code> and &ldquo;date-time&rdquo; classes
......@@ -445,6 +446,11 @@ Serialized data in format 3 cannot be read in <span style="font-family: Courier
allows to turn off the warning when applying the default
<code>"Nelder-Mead"</code> method to 1-dimensional problems.
</p>
</li>
<li> <p><code>matplot(.., panel.first = .)</code> etc now work, as
<code>log</code> becomes explicit argument and <code>...</code> is passed to
<code>plot()</code> unevaluated, as suggested by Sebastian Meyer in <a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=17386">PR#17386</a>.
</p>
</li></ul>
......@@ -510,9 +516,11 @@ setting of <span class="samp">SAFE_FFLAGS</span>.
<code>nearbyint</code> are now required.
</p>
</li>
<li> <p><code>configure</code> sets the <span class="option">-std</span> flag for the C++
<li> <p><code>configure</code> sets a <span class="option">-std</span> flag for the C++
compiler for all supported C++ standards (e.g., <span class="option">-std=gnu++11</span>
for the C++11 compiler).
for the C++11 compiler). Previously this was not done in a few
cases where the default standard passed the tests made
(e.g. <code>clang 6.0.0</code> for C++11).
</p>
</li></ul>
......@@ -807,9 +815,16 @@ no longer produces <code>R CMD check</code> warnings.
</p>
</li>
<li> <p><code>match.arg()</code> more carefully chooses the environment
for constucting default <code>choices</code>, fixing <a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=17401">PR#17401</a> as
for constructing default <code>choices</code>, fixing <a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=17401">PR#17401</a> as
proposed by Duncan Murdoch.
</p>
</li>
<li><p> Deparsing of consecutive <code>!</code> calls is now consistent
with deparsing unary <code>-</code> and <code>+</code> calls and creates code
that can be reparsed exactly; thanks to a patch by Lionel Henry in
<a href="https://bugs.R-project.org/bugzilla3/show_bug.cgi?id=17397">PR#17397</a>. (As a side effect, this uses fewer parentheses in
some other deparsing involving <code>!</code> calls.)
</p>
</li></ul>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for R, version 3.5.0 alpha (2018-04-04).
<!-- This manual is for R, version 3.5.0 beta (2018-04-10).
Copyright (C) 2001-2018 R Core Team
......@@ -333,7 +333,7 @@ p {
<p>This is a guide to installation and administration for R.
</p>
<p>This manual is for R, version 3.5.0 alpha (2018-04-04).
<p>This manual is for R, version 3.5.0 beta (2018-04-10).
</p>
<p>Copyright &copy; 2001&ndash;2018 R Core Team
</p>
......@@ -1408,7 +1408,7 @@ conversion to short name equivalents (a.k.a. DOS 8.3 names), then R
<em>must</em> be installed in a path that does not contain spaces.
</p>
<p>Installation is <em>via</em> the installer
<samp>R-3.5.0alpha-win.exe</samp>. Just double-click on the icon and
<samp>R-3.5.0beta-win.exe</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.
......@@ -1804,7 +1804,7 @@ source tree) in <samp>src/gnuwin32/installer</samp> run
installation (in double quotes if it contains spaces or backslashes).
</p>
<p>Both methods create an executable with a standard name such as
<samp>R-3.5.0alpha-win.exe</samp>, so please rename it to indicate that
<samp>R-3.5.0beta-win.exe</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
......@@ -1863,21 +1863,21 @@ make msi
</pre></div>
<p>which will result in a file with a name like
<samp>R-3.5.0alpha-win32.msi</samp>. This can be double-clicked to be
<samp>R-3.5.0beta-win32.msi</samp>. This can be double-clicked to be
installed, but those who need it will know what to do with it (usually
by running <code>msiexec /i</code> with additional options). Properties
that users might want to set from the <code>msiexec</code> command line
include &lsquo;<samp>ALLUSERS</samp>&rsquo;, &lsquo;<samp>INSTALLDIR</samp>&rsquo; (something like
<samp>c:\Program Files\R\R-3.5.0alpha</samp>) and &lsquo;<samp>RMENU</samp>&rsquo; (the path
<samp>c:\Program Files\R\R-3.5.0beta</samp>) and &lsquo;<samp>RMENU</samp>&rsquo; (the path
to the &lsquo;<samp>R</samp>&rsquo; folder on the start menu) and &lsquo;<samp>STARTDIR</samp>&rsquo; (the
starting directory for R shortcuts, defaulting to something like
<samp>c:\Users\name\Documents\R</samp>).
</p>
<p>The MSI installer can be built both from a 32-bit build of R
(<samp>R-3.5.0alpha-win32.msi</samp>) and from a 64-bit build of R
(<samp>R-3.5.0alpha-win64.msi</samp>, optionally including 32-bit files
(<samp>R-3.5.0beta-win32.msi</samp>) and from a 64-bit build of R
(<samp>R-3.5.0beta-win64.msi</samp>, optionally including 32-bit files
by setting the macro <code>HOME32</code>, when the name is
<samp>R-3.5.0alpha-win.msi</samp>). Unlike the main installer, a 64-bit
<samp>R-3.5.0beta-win.msi</samp>). Unlike the main installer, a 64-bit
MSI installer can only be run on 64-bit Windows.
</p>
<p>Thanks to David del Campo (Dept of Statistics, University of Oxford)
......@@ -5998,7 +5998,7 @@ install LaTeX packages on first use.
<a name="The-Inno-Setup-installer-1"></a>
<h3 class="section">D.2 The Inno Setup installer</h3>
<p>To make the installer package (<samp>R-3.5.0alpha-win.exe</samp>) we
<p>To make the installer package (<samp>R-3.5.0beta-win.exe</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>Rtools*.exe</samp>.
......
......@@ -109,8 +109,9 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl HP's aCC needs +std=c++11
dnl Cray's crayCC needs "-h std=c++11"
dnl Both omitted here
dnl Oracle Developer Studio CC -library=stlport4 requires -std=sun03
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative}; do
for switch in -std=c++${alternative} -std=sun${alternative}; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
......
Matrix_1.2-12.tar.gz
\ No newline at end of file
Matrix_1.2-13.tar.gz
\ No newline at end of file
cluster_2.0.6.tar.gz
\ No newline at end of file
cluster_2.0.7.tar.gz
\ No newline at end of file
nlme_3.1-136.tar.gz
\ No newline at end of file
nlme_3.1-137.tar.gz
\ No newline at end of file
......@@ -323,3 +323,31 @@ withRestarts <- function(expr, ...) {
if (! is.null(r))
invokeRestart(r)
}
##
## Suspending/Allowing Interrupts
##
suspendInterrupts <- function(expr) {
suspended <- .Internal(interruptsSuspended())
if (suspended)
expr
else {
on.exit(.Internal(interruptsSuspended(suspended)))
.Internal(interruptsSuspended(TRUE))
expr
}
}
allowInterrupts <- function(expr) {
suspended <- .Internal(interruptsSuspended())
if (suspended) {
on.exit(.Internal(interruptsSuspended(suspended)))
.Internal(interruptsSuspended(FALSE))
expr
}
else
expr
}
......@@ -187,9 +187,6 @@ order <- function(..., na.last = TRUE, decreasing = FALSE,
x <- z[[1L]]
if (.Internal(sorted_fpass(x, decreasing, na.last)))
return(seq(along = x))
## try the reverse since that's easy too...
if (.Internal(sorted_fpass(x, !decreasing, na.last)))
return(seq(length(x), 1))
}
method <- match.arg(method)
......@@ -236,9 +233,6 @@ sort.list <- function(x, partial = NULL, na.last = TRUE, decreasing = FALSE,
length(x) > 0){
if (.Internal(sorted_fpass(x, decreasing, na.last)))
return(seq(along = x))
## try the reverse since that's easy too...
if (.Internal(sorted_fpass(x, !decreasing, na.last)))
return(seq(length(x), 1))
}
method <- match.arg(method)
......
......@@ -23,6 +23,8 @@
\alias{tryCatch}
\alias{withCallingHandlers}
\alias{withRestarts}
\alias{suspendInterrupts}
\alias{allowInterrupts}
\alias{.signalSimpleWarning}
\alias{.handleSimpleError}
......@@ -73,6 +75,9 @@ isRestart(x)
restartDescription(r)
restartFormals(r)
suspendInterrupts(expr)
allowInterrupts(expr)
.signalSimpleWarning(msg, call)
.handleSimpleError(h, msg, call)
.tryResumeInterrupt()
......@@ -194,6 +199,11 @@ restartFormals(r)
\code{interactive} method queries the user for values for the
formal arguments of the handler function.
Interrupts can be suspended while evaluating an expression using
\code{suspendInterrupts}. Subexpression can be evaluated with
interrupts enabled using \code{allowInterrupts}. These functions
can be used to make sure cleanup handlers cannon be interrupted.
\code{.signalSimpleWarning}, \code{.handleSimpleError}, and
\code{.tryResumeInterrupt} are used internally and should not be
called directly.
......
% File src/library/base/man/connections.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2017 R Core Team
% Copyright 1995-2018 R Core Team
% Distributed under GPL 2 or later
\name{connections}
......@@ -566,31 +566,35 @@ isIncomplete(con)
}
\examples{
zz <- file("ex.data", "w") # open an output file connection
zzfil <- tempfile(fileext=".data")
zz <- file(zzfil, "w") # open an output file connection
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
cat("One more line\n", file = zz)
close(zz)
readLines("ex.data")
unlink("ex.data")
readLines(zzfil)
unlink(zzfil)
zz <- gzfile("ex.gz", "w") # compressed file
zzfil <- tempfile(fileext=".gz")
zz <- gzfile(zzfil, "w") # compressed file
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
close(zz)
readLines(zz <- gzfile("ex.gz"))
readLines(zz <- gzfile(zzfil))
close(zz)
unlink("ex.gz")
unlink(zzfil)
zz # an invalid connection
zz <- bzfile("ex.bz2", "w") # bzip2-ed file
zzfil <- tempfile(fileext=".bz2")
zz <- bzfile(zzfil, "w") # bzip2-ed file
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
close(zz)
zz # print() method: invalid connection
print(readLines(zz <- bzfile("ex.bz2")))
print(readLines(zz <- bzfile(zzfil)))
close(zz)
unlink("ex.bz2")
unlink(zzfil)
## An example of a file open for reading and writing
Tfile <- file("test1", "w+")
Tpath <- tempfile("test")
Tfile <- file(Tpath, "w+")
c(isOpen(Tfile, "r"), isOpen(Tfile, "w")) # both TRUE
cat("abc\ndef\n", file = Tfile)
readLines(Tfile)
......@@ -601,7 +605,7 @@ readLines(Tfile)
Tfile # -> print() : "valid" connection
close(Tfile)
Tfile # -> print() : "invalid" connection
unlink("test1")
unlink(Tpath)
## We can do the same thing with an anonymous file.
Tfile <- file()
......@@ -611,11 +615,12 @@ close(Tfile)
\dontrun{## fifo example -- may hang even with OS support for fifos
if(capabilities("fifo")) {
zz <- fifo("foo-fifo", "w+")
zzfil <- tempfile(fileext="-fifo")
zz <- fifo(zzfil, "w+")
writeLines("abc", zz)
print(readLines(zz))
close(zz)
unlink("foo-fifo")
unlink(zzfil)
}}
#ifdef unix
\donttest{
......@@ -626,6 +631,7 @@ readLines(pipe("ls -1"))
# remove trailing commas. Suppose
\dontshow{
oldwd <- setwd(tempdir())
writeLines(c("450, 390, 467, 654, 30, 542, 334, 432, 421,",
"357, 497, 493, 550, 549, 467, 575, 578, 342,",
"446, 547, 534, 495, 979, 479"), "data2_")}
......@@ -635,14 +641,15 @@ writeLines(c("450, 390, 467, 654, 30, 542, 334, 432, 421,",
446, 547, 534, 495, 979, 479}
# Then read this by
scan(pipe("sed -e s/,$// data2_"), sep = ",")
\dontshow{unlink("data2_")}
\dontshow{unlink("data2_"); setwd(oldwd)}
# convert decimal point to comma in output: see also write.table
# both R strings and (probably) the shell need \ doubled
zz <- pipe(paste("sed s/\\\\\\\\./,/ >", "outfile"), "w")
zzfil <- tempfile("outfile")
zz <- pipe(paste("sed s/\\\\\\\\./,/ >", zzfil), "w")
cat(format(round(stats::rnorm(48), 4)), fill = 70, file = zz)
close(zz)
file.show("outfile", delete.file = TRUE)
file.show(zzfil, delete.file = TRUE)
}
\dontrun{
## example for a machine running a finger daemon
......
% File src/library/base/man/dput.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2017 R Core Team
% Copyright 1995-2018 R Core Team
% Distributed under GPL 2 or later
\name{dput}
......@@ -74,10 +74,11 @@ dget(file, keep.source = FALSE)
\code{\link{deparse}}, \code{\link{dump}}, \code{\link{write}}.
}
\examples{
## Write an ASCII version of function mean to the file "foo"
dput(mean, "foo")
fil <- tempfile()
## Write an ASCII version of function mean to our temp file
dput(mean, fil)
## And read it back into 'bar'
bar <- dget("foo")
bar <- dget(fil)
## Create a function with comments
baz <- function(x) {
# Subtract from one
......@@ -93,11 +94,11 @@ xx <- pi^(1:3)
dput(xx)
dput(xx, control = "digits17")
dput(xx, control = "hexNumeric")
dput(xx, "foo"); dget("foo") - xx # slight rounding on all platforms
dput(xx, "foo", control = "digits17")
dget("foo") - xx # slight rounding on some platforms
dput(xx, "foo", control = "hexNumeric"); dget("foo") - xx
unlink("foo")
dput(xx, fil); dget(fil) - xx # slight rounding on all platforms
dput(xx, fil, control = "digits17")
dget(fil) - xx # slight rounding on some platforms
dput(xx, fil, control = "hexNumeric"); dget(fil) - xx
unlink(fil)
xn <- setNames(xx, paste0("pi^",1:3))
dput(xn) # nicer, now "niceNames" being part of default 'control'
......
......@@ -100,9 +100,10 @@ dump(list, file = "dumpdata.R", append = FALSE,
}
\examples{
x <- 1; y <- 1:10
dump(ls(pattern = '^[xyz]'), "xyz.Rdmped")
fil <- tempfile(fileext=".Rdmped")
dump(ls(pattern = '^[xyz]'), fil)
print(.Last.value)
unlink("xyz.Rdmped")
unlink(fil)
}
\keyword{file}
\keyword{connection}
......@@ -218,23 +218,26 @@ Sys.junction(from, to)
}
\examples{
\dontshow{oldwd <- setwd(tempdir())}
cat("file A\n", file = "A")
cat("file B\n", file = "B")
file.append("A", "B")
file.create("A")
file.create("A") # (trashing previous)
file.append("A", rep("B", 10))
if(interactive()) file.show("A")
if(interactive()) file.show("A") # -> the 10 lines from 'B'
file.copy("A", "C")
dir.create("tmp")
file.copy(c("A", "B"), "tmp")
list.files("tmp")
list.files("tmp") # -> "A" and "B"
#ifdef unix
setwd("tmp")
file.remove("B")
file.remove("A") # the tmp/A file
file.symlink(file.path("..", c("A", "B")), ".")
# |--> (TRUE,FALSE) : ok for A but not B as it exists already
setwd("..")
#endif
unlink("tmp", recursive = TRUE)
file.remove("A", "B", "C")
\dontshow{setwd(oldwd)}
}
\keyword{file}
......@@ -63,19 +63,22 @@ dat[1:4, ]
## gzfile and gzcon can inter-work.
## Of course here one would use gzfile, but file() can be replaced by
## any other connection generator.
zz <- gzfile("ex.gz", "w")
zzfil <- tempfile(fileext = ".gz")
zz <- gzfile(zzfil, "w")
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
close(zz)
readLines(zz <- gzcon(file("ex.gz", "rb")))
readLines(zz <- gzcon(file(zzfil, "rb")))
close(zz)
unlink("ex.gz")
unlink(zzfil)
% Cygwin seems to require a different name
zz <- gzcon(file("ex2.gz", "wb"))
zzfil2 <- tempfile(fileext = ".gz")
zz <- gzcon(file(zzfil2, "wb"))
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
close(zz)
readLines(zz <- gzfile("ex2.gz"))
readLines(zz <- gzfile(zzfil2))
close(zz)
unlink("ex2.gz")
unlink(zzfil2)
}
\keyword{file}
\keyword{connection}
% File src/library/base/man/load.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2017 R Core Team
% Copyright 1995-2018 R Core Team
% Distributed under GPL 2 or later
\name{load}
......@@ -86,31 +86,34 @@ load(file, envir = parent.frame(), verbose = FALSE)
\code{\link{unserialize}} and \code{\link{readRDS}}.
}
\examples{
\dontshow{oldwd <- setwd(tempdir())}
## save all data
xx <- pi # to ensure there is some data
save(list = ls(all = TRUE), file= "all.RData")
save(list = ls(all = TRUE), file= "all.rda")
rm(xx)
## restore the saved values to the current environment
local({
load("all.RData")
load("all.rda")
ls()
})
xx <- exp(1:3)
## restore the saved values to the user's workspace
load("all.RData") ## which is here *equivalent* to
## load("all.RData", .GlobalEnv)
load("all.rda") ## which is here *equivalent* to
## load("all.rda", .GlobalEnv)
## This however annihilates all objects in .GlobalEnv with the same names !
xx # no longer exp(1:3)
rm(xx)
attach("all.RData") # safer and will warn about masked objects w/ same name in .GlobalEnv
attach("all.rda") # safer and will warn about masked objects w/ same name in .GlobalEnv
ls(pos = 2)
## also typically need to cleanup the search path:
detach("file:all.RData")
detach("file:all.rda")
## clean up (the example):
unlink("all.RData")