diffFile: Render the differences between two files as an HTML document...

View source: R/diffFile.R

diffFileR Documentation

Render the differences between two files as an HTML document using the ‘git’ version control software package

Description

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.

Usage

diffFile(
  current_file,
  reference_file = "HEAD",
  diff_algorithm="minimal",
  clean_empyt_lines=FALSE,
  keep_diff = FALSE,
  view = TRUE,
  return_results=TRUE)

Arguments

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 browseURL.

return_results

logical: Return the character string with the location of the HTML results.

Value

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.

Examples

  ## 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)

CenterForAssessment/Literasee documentation built on July 2, 2023, 6:21 p.m.