Converts a document originally created with redoc() back to R Markdown, including changes made to text in MS Word.

dedoc(docx, to = NULL, dir = ".", track_changes = "comments_only",
  block_missing = "comment", inline_missing = "omit",
  wrap = getOption("redoc.wrap", 80), overwrite = FALSE,
  orig_docx = NULL, orig_codefile = NULL, verbose = FALSE)

Arguments

docx

The `.docx`` file to convert

to

the filename to write the resulting .Rmd file. The default is to use the same basename as the docx document

dir

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

track_changes

How to deal with tracked changes and comments in the .docx file. "accept" accepts all changes, and "reject" rejects all of them. The default, "criticmarkup", converts the tracked changes to Critic Markup syntax. "comments_only" will only convert comments, as other changes can be viewed with redoc_diff(). "all" marks up tracked changes and comments in <span> tags and is useful for debugging. See the pandoc manual for details.

block_missing, inline_missing

What to do about code blocks or inline code whose output has been removed in the editing of the Word document. "restore" attempts to restore the code as close to its original location in the document as possible. "comment" will do so but wrap it in HTML comments. "omit" will not restore the code at all.

wrap

The width at which to wrap text. If NA, text is not wrapped. Set the default with "redoc.wrap" in options().

overwrite

Whether to overwrite an existing file

orig_codefile, orig_docx

The original .codelist.yml or Word document created when the document was first knit. Useful for debugging, or in cases where the word file has been corrupted or transformed, for instance, by copy-and-pasting the content into a new file. If provided, dedoc will use this codefile or word file to re-create the .Rmd file with the text of the input.

verbose

whether to print pandoc progress text

Details

R chunks may be lost in the editing process if using non-Microsoft word processors (e.g. LibreOffice or in copy-and-pasting text into a new document.