rrtools icon indicating copy to clipboard operation
rrtools copied to clipboard

Track changes made to the manuscript during peer review.

Open wolass opened this issue 6 years ago • 10 comments

After submitting my first paper in DOCX generated strictly with the rrtools workflow I am now in the first revision.

The problem that occured is that whenever I am introducing changes to the manuscript these are only visible in the .RMD file (and this is perfectly fine if reviewers would use github).

Do you have any ideas how to introduce "changes tracking" in the generated manuscripts - this is often required by journals and generally a good practice to always state what has been modified from the original file.

I suppose a simple color change would be sufficient.

Is there an elegant (or at least a hackable) solution to this?

wolass avatar Feb 14 '18 08:02 wolass

(based on ideas and code from https://stackoverflow.com/a/37122306)

one could define some "revision" colors and use them in the text

#Color Format
rrevise <- function(x, mode = "revise"){
  if(mode == "revise") {
    color <- "red"
  }
  outputFormat <- opts_knit$get("rmarkdown.pandoc.to")
  if(outputFormat == 'latex') {
    paste("\\textcolor{",color,"}{",x,"}",sep="")
  }
  if(outputFormat == 'html') {
    paste("<font color='",color,"'>",x,"</font>",sep="")
  }

  return(x)
}

and use it to write comments like this:

something strange in thes r rrevise("is with this revised",'red') and the rest continues

dakni avatar Feb 14 '18 10:02 dakni

If I understand this correctly, you just want to point out the differences between an old version and the new version of a word document. Word seems to have a feature for this. And it should not matter whether the document was crafted manually or rendered from markdown.

nevrome avatar Feb 14 '18 13:02 nevrome

@nevrome great! This is something that we can work with but it still requires us to do manual post processing of the generated files. Any Ideas ho we could automate this process / script it?

And it also requires that we have WORD installed on our machines. I work on linux and tend to avoid touching generated files with any Linux based word-like processor (e.g. Libre Office), because it is an easy way to introduce formatting errors.

wolass avatar Feb 14 '18 13:02 wolass

Hm.. There's this. But I have no idea, how we could include this in the rrtools workflow. Libre Office also has this feature.

Is automation in this case really necessary? How many times do you have to do this in the workflow for a paper? Maybe just once or twice, or?

nevrome avatar Feb 14 '18 14:02 nevrome

This is a longstanding issue in the pandoc user group, and without any good, simple solutions at the moment. I quite like this, but it is not simple enough for me: http://timotheepoisot.fr/2014/07/10/markdown-track-changes/ There is also http://criticmarkup.com/users-guide.php but it doesn't seem very widely used.

Currently I also use the approach suggested by @nevrome to update the Rmd, output a new MS Word doc, then use the tool in MS Word to compare to the previous version and generate a third version showing the tracked changes. I think that is currently the simplest way to satisfy the requirement to show track changes to an editor.

Automating that process to avoid the use of a specific word processor sounds like a great idea! Perhaps this is relevant: https://github.com/petewarden/catdoc I guess there is some code in here that could be useful: https://github.com/hrbrmstr/docxtractr

benmarwick avatar Feb 14 '18 16:02 benmarwick

@wolass I'm curious to know, what have you found to be a good way to handle this track-changes problem?

I saw a post on twitter about someone using the officer package to insert plots and tables among existing text & track changes in a word doc. They say you can "write in word and then add in output from you r code without affecting tracked changes or citation". That might be useful. Though it's somewhat orthogonal to the R Markdown writing environment used by rrtools

benmarwick avatar Mar 07 '18 17:03 benmarwick

Well for now I simply used @nevrome solution to simply generate a new word file and make a version control of these two using an original microsoft word.

This solution is manual, error prone and does not store the data about the user who had introduced these changes. But it works, and is enough for the publishers when they require a marked up version of a revised manuscript.

wolass avatar Mar 08 '18 13:03 wolass

I asked around : https://stackoverflow.com/questions/49175151/how-to-track-changes-in-word-docx-files-generated-from-within-r

Tomas Hovorka wrote:

good question. I think from the point of reproducibility I would use packages like officer or ReporteRs to load both files and have a look on some packages in R for comparing objects (e.g. compareDT). Then and use some of comparison functions.

Nothing specific to WordR package I can offer though.

t

wolass avatar Mar 08 '18 14:03 wolass

An excellent possible solution to this problem is the https://github.com/noamross/redoc pkg which enables 'a two-way R-Markdown ⟷ Microsoft Word workflow'. It can digest MS Word track changes and convert to Critic Markup in Rmd.

benmarwick avatar Apr 16 '19 22:04 benmarwick

If we can do something like this with word_document2 and redoc, then we might have a solution here:

image

@wolass would you be able to try that and let us know what you find out? Thank you very much!

benmarwick avatar Mar 19 '20 18:03 benmarwick