Type Package Package WordR September 7, 2017 Title Rendering Word Documents with R Inline Code Version 0.2.2 Author Tomas Hovorka Maintainer Tomas Hovorka <tomashovorka@seznam.cz> Serves for rendering MS Word documents with R inline code and inserting tables and plots. License GPL-3 Encoding UTF-8 LazyData true Imports dplyr, ReporteRs, officer RoxygenNote 6.0.1 Suggests knitr, rmarkdown, ggplot2, testthat VignetteBuilder knitr NeedsCompilation no Repository CRAN Date/Publication 2017-09-07 20:49:14 UTC R topics documented: addflextables........................................ 2 addplots........................................... 3 examplepath......................................... 4 renderinlinecode...................................... 4 WordR............................................ 5 Index 6 1
2 addflextables addflextables Read Word document with bookmarks and create other Word document with rendered tables in place. This function is basically a loop wrapper around addflextable function. addflextables(docxin, docxout, FlexTables = list(), debug = F,...) Arguments docxin docxout FlexTables debug String of length one; path to Word file with bookmarks. String of length one; path for output Word file. Named list of FlexTables; Tables to be inserted into the Word file Boolean of length one; If True then browser() is called at the beginning of the function... Parameters to be sent to other methods (mainly addflextable) Path to the rendered Word file if the operation was successfull. library(reporters) ft_mtcars <- vanilla.table(mtcars) ft_iris <- vanilla.table(iris) FT <- list(ft_mtcars=ft_mtcars,ft_iris=ft_iris) addflextables( paste(examplepath(),'templates/templateft.docx',sep = ''), paste(examplepath(),'results/resultft.docx',sep = ''), FT)
addplots 3 addplots Read Word document with bookmarks and create other Word documnet with rendered plots in place. This function is basically a loop wrapper around addplot function. addplots(docxin, docxout, Plots = list(), debug = F,...) Arguments docxin docxout Plots debug String of length one; path to Word file with bookmarks. String of length one; path for output Word file. Named list of function creating plots (see addplot) for details) to be inserted into the Word file Boolean of length one; If True then browser() is called at the beginning of the function... Parameters to be sent to other methods (mainly addplot) Path to the rendered Word file if the operation was successfull. library(ggplot2) Plots<-list(plot1=function()plot(hp~wt,data=mtcars,col=cyl), plot2=function()print(ggplot(mtcars,aes(x=wt,y=hp,col=as.factor(cyl)))+geom_point())) addplots( paste(examplepath(),'templates/templateplots.docx',sep = ''), paste(examplepath(),'results/resultplots.docx',sep = ''), Plots,height=4)
4 renderinlinecode examplepath Returns path to examples folder Returns path to examples folder examplepath() Returns path to examples folder examplepath() renderinlinecode Read Word document with R code blocks, evaluate them and writes the result into another Word document. Read Word document with R code blocks, evaluate them and writes the result into another Word document. renderinlinecode(docxin, docxout, debug = F) Arguments docxin docxout debug String of length one; path to Word file with R code blocks. String of length one; path for output Word file. Boolean of length one; If True then browser() is called at the beginning of the function Path to the rendered Word file if the operation was successfull.
WordR 5 library(reporters) renderinlinecode( paste(examplepath(),'templates/template1.docx',sep = ''), paste(examplepath(),'results/result1.docx',sep = '')) WordR WordR: package for rendering MS Word documents with R inline code and inserting tables and plots. Details The WordR package provides three main functions addflextables, addplots and renderinlinecode, which together should provide enough functionality to create a nice, customised MS Word report from a given template. More information about the package can be found in vignette or run: vignette("wordr", package = "WordR")
Index addflextable, 2 addflextables, 2, 5 addplot, 3 addplots, 3, 5 browser, 2 4 examplepath, 4 renderinlinecode, 4, 5 WordR, 5 WordR-package (WordR), 5 6