save_tt {tinytable}R Documentation

Save a Tiny Table to File

Description

This function saves an object of class tinytable to a specified file and format, with an option to overwrite existing files.

Usage

save_tt(x, output, overwrite = FALSE)

Arguments

x

The tinytable object to be saved.

output

String or file path.

  • If output is "markdown", "latex", "html", or "typst", the table is returned in a string as an R object.

  • If output is a valid file path, the table is saved to file. The supported extensions are: .docx, .html, .png, .pdf, .tex, .typ, and .md (with aliases .txt, .Rmd and .qmd).

overwrite

A logical value indicating whether to overwrite an existing file.

Value

A string or TRUE when the table is written to file.

Examples

library(tinytable)
x <- mtcars[1:4, 1:5]

fn <- file.path(tempdir(), "test.html")
tt(x) |> save_tt(fn, overwrite = TRUE)

library(tinytable)
filename <- file.path(tempdir(), "table.tex")
tt(mtcars[1:4, 1:4]) |> save_tt(filename)


[Package tinytable version 0.3.0 Index]