diffr | R Documentation |
Takes the diff of 2 files and shows comparisons
diffr(
file1,
file2,
contextSize = 3,
minJumpSize = 10,
wordWrap = TRUE,
before = file1,
after = file2,
width = NULL,
height = NULL
)
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 |
height |
passed to |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.