TableOne Export#

Export a TableOne object (produced by to_tableone()) to various formats. Each function accepts an optional file_path — when omitted the formatted string is returned instead of written to disk.

corr_vars.utils.tableone.tableone_to_latex(tableone, file_path=None)[source]#

Convert a TableOne object to a LaTeX table string.

Parameters:
  • tableone (TableOne) – The TableOne object to convert.

  • file_path (str | PathLike[str] | None) – The path to the file where the LaTeX table will be saved.

Returns:

A LaTeX table string representing the TableOne object if file_path is None, otherwise None.

Return type:

str

corr_vars.utils.tableone.tableone_to_markdown(tableone, file_path=None)[source]#

Convert a TableOne object to a Markdown table string.

Parameters:
  • tableone (TableOne) – The TableOne object to convert.

  • file_path (str | PathLike[str] | None) – The path to the file where the Markdown table will be saved.

Returns:

A Markdown table string representing the TableOne object if file_path is None, otherwise None.

Return type:

str

corr_vars.utils.tableone.tableone_to_html(tableone, file_path=None)[source]#

Convert a TableOne object to an HTML table string.

Parameters:
  • tableone (TableOne) – The TableOne object to convert.

  • file_path (str | PathLike[str] | None) – The path to the file where the HTML table will be saved.

Returns:

An HTML table string representing the TableOne object if file_path is None, otherwise None.

Return type:

str

corr_vars.utils.tableone.tableone_to_pdf(tableone, file_path)[source]#

Convert a TableOne object to a PDF file. This function generates a LaTeX file from the TableOne object and compiles it to PDF using pdflatex. Note that pdflatex must be installed and available in the system PATH for this function to work.

Parameters:
  • tableone (TableOne) – The TableOne object to convert.

  • file_path (str | PathLike[str]) – The path to the file where the PDF table will be saved.

Return type:

None

Returns:

None