myknit: myknit

myknitR Documentation

myknit

Description

myknit can be used to make the process of knitting more flexible. The Usage and Arguments section specify how the function would be used on a standalone base.

Normally however I do the knit with the knit button in RStudio. When I include in the yaml metadata block the yaml statement
knit: (function (...) { HOQCutil::myknit(...) }) the myknit code will be run instead of rmarkdown::render.

The myknit function removes (R) commented lines from the yaml metadata block and can do one or more of the following things (based on extra YAML statements):

  • specify an alternative name for the output file (based on hoqc_output)

  • append a version indicator to the name of the output file (based on hoqc_version)

  • force that the proper extension is given to the name of the output file (when not specified) (based on hoqc_force_ext)

  • create a file with the yaml metadata block that was specified with a name including the version indicator (based on hoqc_yaml)

  • create a file with the yaml metadata block after processing with a name including the version indicator (based on hoqc_yaml_new)

  • create a copy of the input file with a name including the version indicator (based on hoqc_rmd_in)

  • create a copy of the processed input file with a name including the version indicator (based on hoqc_rmd_out) An example of use is given in the pdf file and the corresponding rmd file of the GitHub repository rmd_pdf_examples.
    Note: in the repository the myknit function is (still) included as a separate function.

Usage

myknit(
  inputFile,
  encoding = getOption("encoding"),
  hoqc_render = TRUE,
  clean = TRUE
)

Arguments

inputFile

base file to render

encoding

encoding of basefile

hoqc_render

boolean to indicate that output file is to be created. Default TRUE

clean

boolean to indicate that intermediary files are removed. Default TRUE


HanOostdijk/HOQCutil documentation built on July 28, 2023, 5:56 p.m.