searches in several directories for files with Rmd suffix. Skip some file names that contain strings in ar_spn_skip. Save output rendered HTML and PDF files to a directory. And control if to render Rmd to PDF, HTML as well as R.

ff_sup_rmd2htmlpdfr(
  ar_spt_root = c("C:/Users/fan/R4Econ/amto/array/",
    "C:/Users/fan/R4Econ/math/integration"),
  ar_spn_skip = c("basics", "integrate"),
  st_rmd_suffix_pattern = ".Rmd",
  st_save_add_suffix = "",
  spt_out_directory = "C:/Users/fan/downloads",
  bl_recursive = TRUE,
  ls_bool_convert = list(bl_pdf = TRUE, bl_html = TRUE, bl_R = TRUE),
  bl_verbose = TRUE
)

Arguments

ar_spt_root

array of string paths of folders to search in

ar_spn_skip

array a string array of names, if path found contains any of the string in the array, will skip.

st_rmd_suffix_pattern

string name of file suffix to search over

st_save_add_suffix

string suffix to add to rendered html, pdf files

spt_out_directory

string full path of where to store the rendered html, pdf, r files

bl_recursive

boolean if to search in folders recursively

ls_bool_convert

list of booleans to generate pdf, html and or R file. Generate only HTML for example. considered included, searched and found

bl_verbose

verbose printing more

Value

a list of string paths of files generated

  • ls_spt_pdf_generated - a list of pdf file names

  • ls_spt_html_generated - a list of html file names

  • ls_spt_R_generated - a list of R file names generated

#'

Author

Fan Wang, http://fanwangecon.github.io

Examples

ar_spt_root <- c('C:/Users/fan/R4Econ/support/rmd')
ar_spn_skip <- c('matrix', 'tibble', '_main')
spt_out_directory <- 'C:/Users/fan/downloads'
st_save_add_suffix <- '_newsave'
ls_bool_convert <- list(bl_pdf=TRUE, bl_html=TRUE, bl_R=TRUE)
bl_verbose <- TRUE
ff_sup_rmd2htmlpdfr(ar_spt_root=ar_spt_root, ar_spn_skip=ar_spn_skip,
                    spt_out_directory=spt_out_directory, st_save_add_suffix=st_save_add_suffix,
                    ls_bool_convert=ls_bool_convert,
                    bl_verbose=bl_verbose)
#> spn_file_pdf:C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf, PDF started
#> 
#> 
#> processing file: fs_test_a.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |......................................................................| 100%
#> label: unnamed-chunk-1
#> 
#> output file: fs_test_a.knit.md
#> "G:/ProgramData/Anaconda3/Scripts/pandoc" +RTS -K512m -RTS fs_test_a.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc4d824396d1a.tex --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" 
#> 
#> Output created: C:/Users/fan/Downloads/fs_test_a_newsave.pdf
#> spn_file_pdf:C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf, PDF finished
#> spth_html:C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html, HTML started.
#> 
#> 
#> processing file: fs_test_a.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |......................................................................| 100%
#> label: unnamed-chunk-1
#> 
#> output file: fs_test_a.knit.md
#> "G:/ProgramData/Anaconda3/Scripts/pandoc" +RTS -K512m -RTS fs_test_a.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc4d836b6686b.html --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --self-contained --variable bs3=TRUE --standalone --section-divs --template "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\rmd\h\DEFAUL~1.HTM" --no-highlight --variable highlightjs=1 --variable theme=bootstrap --include-in-header "C:\Users\fan\AppData\Local\Temp\Rtmp8ciw5l\rmarkdown-str4d8773a6ed7.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 
#> 
#> Output created: C:/Users/fan/Downloads/fs_test_a_newsave.html
#> spth_html:C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html, HTML finished.
#> purl_to:C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.R.R
#> 
#> 
#> processing file: C:/Users/fan/R4Econ/support/rmd/fs_test_a.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
  |                                                                            
  |......................................................................| 100%
#> output file: C:/Users/fan/downloads/fs_test_a_newsave.R
#> spn_file_pdf:C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf, PDF started
#> 
#> 
#> processing file: fs_test_b.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |......................................................................| 100%
#> label: unnamed-chunk-1
#> 
#> output file: fs_test_b.knit.md
#> "G:/ProgramData/Anaconda3/Scripts/pandoc" +RTS -K512m -RTS fs_test_b.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc4d8678b4e13.tex --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" 
#> 
#> Output created: C:/Users/fan/Downloads/fs_test_b_newsave.pdf
#> spn_file_pdf:C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf, PDF finished
#> spth_html:C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html, HTML started.
#> 
#> 
#> processing file: fs_test_b.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |......................................................................| 100%
#> label: unnamed-chunk-1
#> 
#> output file: fs_test_b.knit.md
#> "G:/ProgramData/Anaconda3/Scripts/pandoc" +RTS -K512m -RTS fs_test_b.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc4d86dc6403d.html --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\PAGEBR~1.LUA" --lua-filter "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\RMARKD~1\lua\LATEX-~1.LUA" --self-contained --variable bs3=TRUE --standalone --section-divs --template "C:\PROGRA~1\R\R-41~1.2\library\RMARKD~1\rmd\h\DEFAUL~1.HTM" --no-highlight --variable highlightjs=1 --variable theme=bootstrap --include-in-header "C:\Users\fan\AppData\Local\Temp\Rtmp8ciw5l\rmarkdown-str4d86ca2639a.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 
#> 
#> Output created: C:/Users/fan/Downloads/fs_test_b_newsave.html
#> spth_html:C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html, HTML finished.
#> purl_to:C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.R.R
#> 
#> 
#> processing file: C:/Users/fan/R4Econ/support/rmd/fs_test_b.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |...................................                                   |  50%
  |                                                                            
  |......................................................................| 100%
#> output file: C:/Users/fan/downloads/fs_test_b_newsave.R
#> Generated pdf files:
#> [1] ""
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf"
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf"
#>                                                                                
#>                                                                             "" 
#>   C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf 
#> "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf" 
#>   C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf 
#> "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf" 
#> C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdfC:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf
#> Generated html files:
#> [1] ""
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html"
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html"
#>                                                                                 
#>                                                                              "" 
#>   C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html 
#> "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html" 
#>   C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html 
#> "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html" 
#> C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.htmlC:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html
#> Generated R files:
#> [1] ""
#> [1] "C:/Users/fan/downloads/fs_test_a_newsave.R"
#> [1] "C:/Users/fan/downloads/fs_test_b_newsave.R"
#>                                              
#>                                           "" 
#>   C:/Users/fan/downloads/fs_test_a_newsave.R 
#> "C:/Users/fan/downloads/fs_test_a_newsave.R" 
#>   C:/Users/fan/downloads/fs_test_b_newsave.R 
#> "C:/Users/fan/downloads/fs_test_b_newsave.R" 
#> C:/Users/fan/downloads/fs_test_a_newsave.RC:/Users/fan/downloads/fs_test_b_newsave.R
#> $ls_spt_pdf_generated
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.pdf"
#> [2] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.pdf"
#> 
#> $ls_spt_html_generated
#> [1] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_a_newsave.html"
#> [2] "C:/Users/fan/downloads/C:/Users/fan/R4Econ/support/rmd/fs_test_b_newsave.html"
#> 
#> $ls_spt_R_generated
#> [1] "C:/Users/fan/downloads/fs_test_a_newsave.R"
#> [2] "C:/Users/fan/downloads/fs_test_b_newsave.R"
#>