rmdawn package

Submodules

rmdawn.catren module

rmdawn.catren.catren(in_files: List[str], rmd_file: Optional[str] = None, out_file: Optional[str] = None, out_format: Optional[str] = None) → None[source]

Create an R markdown file from source files and then render it.

Parameters
  • in_files – A list of YAML, markdown, and code file names.

  • rmd_file – The name of the intermediate rmd file.

  • out_file – The name of the final output file.

  • out_format – The format of the final output file.

Note

If out_format is not provided, the output format will be inferred from the out_file argument. To create an html notebook, the out_format must be html_notebook. For slides in html or pdf format, the out_format must be - slidy_presentation, - ioslides_presentation, - beamer_presentation, or - revealjs::revealjs_presentation.

Module contents

Rmdawn: a Python package for (de)constructing R markdown files.

rmdawn.rmdawn(in_files: List[str]) → str[source]

Create an R markdown file from YAML, markdown, and code files.

Parameters
  • in_files – A list of YAML, markdown, and code file names.

  • return – A string containing the output R markdown file.

rmdawn.rmdusk(in_file: str) → None[source]

Extract YAML, code, and markdown files from an R markdown file.

Parameters

in_file – The name of the input R markdown file.

rmdawn.rmdtor(in_file: str, out_file: Optional[str] = None)[source]

Convert an R markdown file into an R script.

Parameters
  • in_file – The name of the input R markdown file.

  • out_file – The name of the out_file R script.

rmdawn.rtormd(in_file: str, out_file: Optional[str] = None)[source]

Convert an R script into an R markdown file.

Parameters
  • in_file – The name of the input R script.

  • out_file – The name of the out_file R markdown file.

rmdawn.render(in_file: str, out_file: Optional[str] = None, out_format: Optional[str] = None) → None[source]

Render an R script or R markdown file into another format.

Parameters
  • in_file – The name of the input R script or R markdown file.

  • out_file – The name of the output file.

  • out_format – The format of the output file.

Note

If out_format is not provided, the output format will be inferred from the out_file argument. To create an html notebook, the out_format must be html_notebook. For slides in html or pdf format, the out_format must be - slidy_presentation, - ioslides_presentation, - beamer_presentation, or - revealjs::revealjs_presentation.

rmdawn.extract_after(source: str, start: str) → str[source]

Extract all of the characters after start.

Parameters
  • source – The input string from which to extract a substring.

  • start – The substring that marks the extraction starting place.

  • return – A substring that is extracted from source.

Note

The start string is not include in the result.

rmdawn.extract_before(source: str, end: str) → str[source]

Extract all of the characters before start.

Parameters
  • source – The input string from which to extract a substring.

  • end – The substring that marks the place where extraction will end.

  • return – A substring that is extracted from source.

Note

The end string is not include in the result.

rmdawn.extract_between(source: str, start: str, end: str) → str[source]

Extract all of the characters between start and end.

Parameters
  • source – The input string from which to extract a substring.

  • start – The substring that marks the extraction starting place.

  • end – The substring that marks the place where extraction will end.

  • return – A substring that is extracted from source.

Note

The start and end strings are not include in the result.