Documents produced with redoc() store an copy of the original .Rmd files used to produce them. This is useful for diffing against the version created with dedoc(), especially if tracked changes have not been used.

redoc_extract_rmd(docx, type = c("original", "roundtrip"), dir = ".",
  to = NULL, overwrite = FALSE)

Arguments

docx

A path to a word file or a an rdocx object created with officer::read_docx().

type

One of "original" or "roundtrip". "original" extracts the exact document originally knit. "roundtrip" (default) extracts a document that has been converted to Word and back with no edits in between. The latter should be more useful for comparing against edits, as line-wrapping and placement of no-output chunks should match.

dir

The directory to write the `.Rmd`` to. Defaults to current working directory

to

the filename to write the resulting .Rmd file. The default is to use the the original name with either .orignal.Rmd or roundtrip.Rmd extensions.

overwrite

whether to overwrite existing files

Value

The path to the extracted .Rmd

Examples

redoc_extract_rmd(redoc_example_docx(), dir = tempdir())
#> [1] "/tmp/RtmpRWp2Yi/example.Rmd"