diffFile | R Documentation |
This is a function for rendering the differences between two files as an HTML document. The function depends on the user having git version control software installed. See git documentation for more details.
diffFile(
current_file,
reference_file = "HEAD",
diff_algorithm="minimal",
clean_empyt_lines=FALSE,
keep_diff = FALSE,
view = TRUE,
return_results=TRUE)
current_file |
string: path to file after changes |
reference_file |
string: path to file before changes. |
diff_algorithm |
string: The algorithm to use in ‘git diff’. See git diff for more information. Possible choices are ‘patience’, ‘minimal’, ‘histogram’, or ‘myers’ (‘myers’ is git default). |
clean_empyt_lines |
logical: Should both files be ‘cleaned’ by removing additional lines between text chunks. Only an option for reference_file if it is an actual file (not a git repo). |
keep_diff |
logical: Keep a copy of the HTML file. If TRUE a file is saved to the current_file directory and named after it. |
view |
logical: View the HTML results automatically using |
return_results |
logical: Return the character string with the location of the HTML results. |
string
Returns a character string containing the path for a git diff output file that has been post-processed as an
HTML document using render.
## Not run:
# Check differences between two 'Draft' .Rmd files (not in a git repo)
diffRmd(current_file='Draft/My_Report-Compiled_Draft_v2.Rmd',
reference_file='Draft/My_Report-Compiled_Draft_v1.Rmd',
clean_empyt_lines = TRUE,
keep_diff = TRUE)
## End(Not run)
# An advanced output
## Not run:
# From the Literacy repo directory
# check the current placeFigure.R file against an old commit
diffRmd(current_file='R/placeFigure.R',
reference_file='d47a9e2bdb1fde5723af3877ef21ea18d229ced7')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.