FindReplace {BrailleR} | R Documentation |
Simple wrapper functions to make it easier to replace the text in a file, possibly due to spelling errors, but perhaps to replace default text in a template file.
FindReplace(file, find, replace)
Rnw2Rmd(file)
UseTemplate(file, find=NULL, replace=NULL)
file |
The external (text) file or template to be updated. |
find |
The text to remove. |
replace |
The text to insert. |
The FindReplace function is purely intended for use on an external file whereas UseTemplate is intended to take a template file from within the BrailleR package and return the updated text to the calling environment.
Rnw2Rmd tries to replace Standard LaTeX commands and Sweave chunk headers with R markdown ones. It is NOT comprehensive, but it does get a long way towards a useful markdown file.
Obviously the specified file must exist for these functions to work.
FindReplace will replace the existing file with the updated version while UseTemplate will return a character string which will usually be pushed out to an R script or R markdown file.
A. Jonathan R. Godfrey
UseTemplate("DTGroupSummary.R")
UseTemplate("DTGroupSummary.R", "DataName", "MyData")