| 54635 |
ripley |
1 |
% File src/library/tools/man/Rdiff.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 87358 |
maechler |
3 |
% Copyright 2010-2024 R Core Team
|
| 54635 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 47761 |
ripley |
6 |
\name{Rdiff}
|
| 56186 |
murdoch |
7 |
\alias{Rdiff}
|
| 50080 |
murdoch |
8 |
\title{Difference R Output Files}
|
| 47761 |
ripley |
9 |
\description{
|
|
|
10 |
Given two \R output files, compute differences ignoring headers,
|
| 56350 |
murdoch |
11 |
footers and some other differences.
|
| 47761 |
ripley |
12 |
}
|
|
|
13 |
\usage{
|
| 62172 |
hornik |
14 |
Rdiff(from, to, useDiff = FALSE, forEx = FALSE,
|
|
|
15 |
nullPointers = TRUE, Log = FALSE)
|
| 47761 |
ripley |
16 |
}
|
|
|
17 |
\arguments{
|
|
|
18 |
\item{from, to}{filepaths to be compared}
|
| 82585 |
ripley |
19 |
\item{useDiff}{should \command{diff} be used to compare results?
|
| 82611 |
hornik |
20 |
Overridden to false if the command is not available.}
|
| 50468 |
ripley |
21 |
\item{forEx}{logical: extra pruning for \file{-Ex.Rout} files to
|
| 85046 |
maechler |
22 |
exclude headers and footers of examples, code and results for
|
|
|
23 |
\option{"--timings"}, etc.}
|
| 57257 |
ripley |
24 |
\item{nullPointers}{logical: should the displayed addresses of
|
| 61433 |
ripley |
25 |
pointers be set to \code{0x00000000} before comparison?}
|
| 57257 |
ripley |
26 |
\item{Log}{logical: should the returned value include a log of
|
|
|
27 |
differences found?}
|
| 47761 |
ripley |
28 |
}
|
|
|
29 |
\details{
|
| 62407 |
ripley |
30 |
|
| 57257 |
ripley |
31 |
The \R startup banner and any timing information from \command{R CMD
|
| 62386 |
ripley |
32 |
BATCH} are removed from both files, together with lines about
|
|
|
33 |
loading packages. UTF-8 fancy quotes (see \code{\link{sQuote}}) and
|
|
|
34 |
on Windows, Windows' so-called \sQuote{smart quotes}, are mapped to
|
|
|
35 |
a simple quote. Addresses of environments, compiled bytecode and
|
|
|
36 |
other exotic types expressed as hex addresses
|
| 84750 |
hornik |
37 |
(e.g., \samp{<environment: 0x12345678>}) are mapped to
|
| 62386 |
ripley |
38 |
\code{0x00000000}. The files are then compared line-by-line. If
|
|
|
39 |
there are the same number of lines and \code{useDiff} is false, a
|
| 62407 |
ripley |
40 |
simple \command{diff -b} -like display of differences is printed
|
|
|
41 |
(which ignores trailing spaces and differences in numbers of
|
|
|
42 |
consecutive spaces), otherwise \command{diff -bw} is called on the
|
|
|
43 |
edited files. (This tries to ignore all differences in whitespace:
|
|
|
44 |
note that flag \option{-w} is not required by POSIX but is supported
|
| 82585 |
ripley |
45 |
by GNU, Solaris and FreeBSD versions -- macOS uses an old GNU version.)
|
| 56951 |
ripley |
46 |
|
| 82588 |
ripley |
47 |
%% Unreliable with 2022-07 gsub changes.
|
|
|
48 |
%% This can compare uncompressed PDF files, ignoring differences in
|
|
|
49 |
%% creation and modification dates. However, non-ASCII text may not be
|
|
|
50 |
%% handled in UTF-8 locales, and it does not check if the PDF files really
|
|
|
51 |
%% are uncompressed. Using \code{useDiff = TRUE} is likely to be more
|
|
|
52 |
%% successful if a \command{diff} command is available.
|
| 72658 |
ripley |
53 |
|
| 82605 |
ripley |
54 |
There is limited support for comparing PDF files produced by
|
|
|
55 |
\code{pdf(compress = FALSE)}, mainly for use in \command{make check}
|
|
|
56 |
-- this requires a \command{diff} command and \code{useDiff = TRUE}.
|
|
|
57 |
|
| 82586 |
ripley |
58 |
Mainly for use in examples and tests, text from marker
|
| 72658 |
ripley |
59 |
\samp{> ## IGNORE_RDIFF_BEGIN} up to (but not including)
|
|
|
60 |
\samp{> ## IGNORE_RDIFF_END} is ignored.
|
| 87358 |
maechler |
61 |
In examples, since \R 4.4.0, the built-in Rd macro \verb{\dontdiff\{\}}
|
|
|
62 |
can be used instead.
|
| 47761 |
ripley |
63 |
}
|
|
|
64 |
\value{
|
| 54626 |
ripley |
65 |
If \code{Log} is true, a list with components \code{status} (see
|
|
|
66 |
below) and \code{out}, a character vector of descriptions of
|
|
|
67 |
differences, possibly of zero length.
|
|
|
68 |
|
| 82603 |
ripley |
69 |
Otherwise, a status indicator (invisibly), \code{0L} if and only if no
|
|
|
70 |
differences were found.
|
| 47761 |
ripley |
71 |
}
|
|
|
72 |
|
|
|
73 |
\seealso{
|
| 82586 |
ripley |
74 |
The shell script run as \command{R CMD Rdiff}, which uses
|
|
|
75 |
\code{useDiff = TRUE}.
|
| 47761 |
ripley |
76 |
}
|
|
|
77 |
|
|
|
78 |
\keyword{utilities}
|
|
|
79 |
|