Learn R Programming

diffr (version 0.0.1)

diffr: Diff 2 files side by side

Description

Takes the diff of 2 files and shows comparisons

Usage

diffr(file1, file2, contextSize = 3, minJumpSize = 10, wordWrap = TRUE, before = file1, after = file2, width = NULL, height = NULL)

Arguments

file1
First file to take diff (usually original file)
file2
First file to take diff (usually updated file)
contextSize
Minimum number of lines of context to show around each diff hunk. (default: 3).
minJumpSize
Minimum number of equal lines to collapse into a ``Show N more lines'' link. (default: 10)
wordWrap
By default, code will go all the way to the right margin of the diff. If there are 60 characters of space, character 61 will wrap to the next line, even mid-word. To wrap at word boundaries instead, set this option.
before
Text to display on file1
after
Text to display on file2
width
passed to createWidget
height
passed to createWidget

Examples

Run this code
library(diffr)
file1 = tempfile()
writeLines("hello, world!\n", con = file1)
file2 = tempfile()
writeLines(paste0(
"hello world?\nI don't get it\n",
paste0(sample(letters, 65, replace = TRUE), collapse = "")), con = file2)
diffr(file1, file2, before = "f1", after = "f2")

Run the code above in your browser using DataLab