read.csv
and passes the resulting data
frames onto diffPrint
. extra
values are passed as
arguments are passed to both read.csv
and print
. To the
extent you wish to use different extra
arguments for each of those
functions you will need to read.csv
the files and pass them to
diffPrint
yourself.
diffCsv(target, current, ...)
"diffCsv"(target, current, mode = gdo("mode"), context = gdo("context"), format = gdo("format"), brightness = gdo("brightness"), color.mode = gdo("color.mode"), word.diff = gdo("word.diff"), pager = gdo("pager"), guides = gdo("guides"), trim = gdo("trim"), rds = gdo("rds"), unwrap.atomic = gdo("unwrap.atomic"), max.diffs = gdo("max.diffs"), disp.width = gdo("disp.width"), ignore.white.space = gdo("ignore.white.space"), convert.hz.white.space = gdo("convert.hz.white.space"), tab.stops = gdo("tab.stops"), line.limit = gdo("line.limit"), hunk.limit = gdo("hunk.limit"), align = gdo("align"), style = gdo("style"), palette.of.styles = gdo("palette"), frame = par_frame(), interactive = gdo("interactive"), term.colors = gdo("term.colors"), tar.banner = NULL, cur.banner = NULL, extra = list())
target
git diff
getOption("width")
is less than 80,
or in diffPrint
and objects are dimensioned and do not fit side
by side, or in diffChr
, diffDeparse
, diffFile
and
output does not fit in side by side without wrapping
-1L
to allow as many as
there are. Set to auto to display as many as 10 lines or as few
as 1 depending on whether total screen lines fit within the number of lines
specified in line.limit
. Alternatively pass the return value of
auto_context
to fine tune the parameters of the auto context
calculation.Defaults to auto. See PaletteOfStyles
for details
on customization, style
for full control of output format.
PaletteOfStyles
for details and limitations. Advanced: you may specify brightness as a
function of format
. For example, if you typically wish to use a
dark color scheme, except for when in html format when
you prefer the light scheme, you may use
c("dark", html="light")
as the value for this parameter. This is
particularly useful if format
is set to auto or if you
want to specify a default value for this parameter via options. Any names
you use should correspond to a format
. You must have one unnamed
value which will be used as the default for all format
s that are
not explicitly specified.PaletteOfStyles
for
details and limitations. Also offers the same advanced usage as the
brightness
paramter.Pager
object; controls whether and how a
pager is used to display the diff output. If on will use the
pager associated with the Style
specified via the
style
parameters. if auto (default) will behave
like on but only if in interactive mode. If the pager is
enabled, default behavior is to pipe output to file.show
if
output is taller than the estimated terminal height and your terminal
supports ANSI escape sequences. If not, the default is to attempt to pipe
output to a web browser with browseURL
. See
Pager
, Style
, and PaletteOfStyles
for more details.guides
for more details.[1,]
) so they alone do not show up as differences in the
diff. See trim
for more details.target
and/or current
point to a file that can be read with
readRDS
and if so, loads the R object contained in the file
and carries out the diff on the object instead of the original argument.
Currently there is no mechanism for specifying additional arguments to
readRDS
diffPrint
, if TRUE, and word.diff
is also TRUE, and both
target
and current
are unnamed and atomic, the vectors
are unwrapped and diffed element by element, and then re-wrapped. Since
diffPrint
is fundamentally a line diff, the re-wrapped lines are
lined up in a manner that is as consistent as possible with the unwrapped
diff. Lines that contain the location of the word differences will be
paired up. Since the vectors may well be wrapped with different
periodicities this will result in lines that are paired up that look like
they should not be paired up, though the locations of the differences
should be.O(n^2)
diff algorithm in favor of a linear one. Set to
-1L
to always stick to the original algorithm (defaults to 10000L).mode
the effective display width is half this
number (set to 0L to use default widths which are getOption("width")
for normal styles and 120L
for HTML styles.tab.stops
.-1
means no limit. If length 2, the first
value indicates the threshold of screen lines to begin truncating output,
and the second the number of lines to truncate to, which should be fewer
than the threshold. Note that this parameter is implemented on a
best-efforts basis and should not be relied on to produce the exact
number of lines requested. If you want a specific number of lines use
[
or head
/tail
. One advantage of line.limit
over these other options is that you can combine it with
context="auto"
and auto max.level
selection (the latter for
diffStr
), which allows the diff to dynamically adjust to make best
use of the available display lines. [
, head
, and tail
just subset the text of the output.line.limit
. How many hunks are in a
particular diff is a function of how many differences, and also how much
context
is used since context can cause two hunks to bleed into
each other and become one.target
that must be matched in a line of
current
in the same hunk for those lines to be paired up when
displayed (defaults to 0.25), or an AlignThreshold
object.
Set to 1
to turn off alignment which will cause all lines in a hunk
from target
to show up first, followed by all lines from
current
.PaletteOfStyles
object; advanced usage,
contains all the Style
objects that are selected by
specifying the format
, brightness
, and color.mode
parameters. See PaletteOfStyles
for more details.print/show/str
, calls and for diffObj
, the evaluation frame
for the diffPrint
/diffStr
calls. Defaults to the return
value of par_frame
.interactive
. If in interactive mode, pager will be used if
pager
is auto, and if ANSI styles are not supported and
style
is auto, output will be send to browser as HTML.crayon::num_colors
does not properly detect how
many ANSI colors are supported by your terminal. Defaults to return value
of crayon::num_colors
and should be 8 or 256 to
allow ANSI colors, or any other number to disallow them. This only
impacts output format selection when style
and format
are
both set to auto.target
and current
expressions.tar.banner
, but for
current
print
,
str
, etc.)Diff
object; see diffPrint
.
diffPrint
for details on the diff*
functions,
diffObj
, diffStr
,
diffChr
to compare character vectors directly
iris.2 <- iris
iris.2$Sepal.Length[5] <- 99
f1 <- tempfile()
f2 <- tempfile()
write.csv(iris, f1, row.names=FALSE)
write.csv(iris.2, f2, row.names=FALSE)
diffCsv(f1, f2)
unlink(c(f1, f2))
Run the code above in your browser using DataLab